mirror of
https://github.com/wassname/curl.git
synced 2026-09-10 12:00:44 +08:00
edits
This commit is contained in:
+2
-1
@@ -1,4 +1,5 @@
|
||||
tmp/
|
||||
notebooks/
|
||||
__pycache__/
|
||||
.ipynb_checkpoints/
|
||||
.ipynb_checkpoints/
|
||||
scripts/run_*.sh
|
||||
@@ -4,12 +4,12 @@ gpuList=(1 2 3 4 5 6 7)
|
||||
(
|
||||
for i in ${gpuList[@]}; do
|
||||
CUDA_VISIBLE_DEVICES=$i python train.py \
|
||||
--domain_name reacher \
|
||||
--task_name easy \
|
||||
--domain_name ball_in_cup \
|
||||
--task_name catch \
|
||||
--encoder_type pixel \
|
||||
--action_repeat 4 \
|
||||
--save_tb --pre_transform_image_size 100 --image_size 84 \
|
||||
--work_dir ./tmp/curl/reacher_easy \
|
||||
--work_dir ./tmp/curl/ball_in_cup \
|
||||
--agent curl_sac --frame_stack 3 \
|
||||
--seed -1 --critic_lr 1e-3 --actor_lr 1e-3 --eval_freq 20000 --batch_size 128 --num_train_steps 1000000 &
|
||||
done
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import dmc2gym
|
||||
import time
|
||||
import tqdm
|
||||
|
||||
env = dmc2gym.make(
|
||||
domain_name='reacher',
|
||||
task_name='easy',
|
||||
seed=0,
|
||||
visualize_reward=False,
|
||||
from_pixels=True,
|
||||
height=84,
|
||||
width=84,
|
||||
frame_skip=3
|
||||
)
|
||||
|
||||
t = time.time()
|
||||
obs = env.reset()
|
||||
for i in tqdm.tqdm(range(1000)):
|
||||
a = env.action_space.sample()
|
||||
o,r,d,info = env.step(a)
|
||||
if d:
|
||||
break
|
||||
|
||||
print('time',time.time()-t)
|
||||
@@ -82,6 +82,7 @@ def evaluate(env, agent, video, num_episodes, L, step, args):
|
||||
all_ep_rewards = []
|
||||
|
||||
def run_eval_loop(sample_stochastically=True):
|
||||
start_time = time.time()
|
||||
prefix = 'stochastic_' if sample_stochastically else ''
|
||||
for i in range(num_episodes):
|
||||
obs = env.reset()
|
||||
@@ -104,12 +105,13 @@ def evaluate(env, agent, video, num_episodes, L, step, args):
|
||||
L.log('eval/' + prefix + 'episode_reward', episode_reward, step)
|
||||
all_ep_rewards.append(episode_reward)
|
||||
|
||||
L.log('eval/' + prefix + 'eval_time', time.time()-start_time , step)
|
||||
mean_ep_reward = np.mean(all_ep_rewards)
|
||||
best_ep_reward = np.max(all_ep_rewards)
|
||||
L.log('eval/' + prefix + 'mean_episode_reward', mean_ep_reward, step)
|
||||
L.log('eval/' + prefix + 'best_episode_reward', best_ep_reward, step)
|
||||
|
||||
run_eval_loop(sample_stochastically=True)
|
||||
#run_eval_loop(sample_stochastically=True)
|
||||
run_eval_loop(sample_stochastically=False)
|
||||
L.dump(step)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user