Skip to content

Commit

Permalink
Merge pull request #301 from WentseChen/crafter_release
Browse files Browse the repository at this point in the history
update_crafter_hyper-para
  • Loading branch information
WentseChen committed May 23, 2024
2 parents 87052cc + 18723ea commit 2c70785
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 4 additions & 1 deletion examples/crafter/crafter_ppo.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
seed: 0
lr: 7e-4
critic_lr: 7e-4
episode_length: 256
episode_length: 512
ppo_epoch: 5
data_chunk_length: 8
num_mini_batch: 8
run_dir: ./run_results/
experiment_name: train_crafter
log_interval: 10
Expand Down
10 changes: 9 additions & 1 deletion openrl/envs/crafter/crafter.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def __init__(
)

self.action_space = gym.spaces.Discrete(self.env.action_space.n)

self.rand_seed = 42

def step(self, action: int):
obs, reward, done, truncated, info = self.env.step(action)
Expand All @@ -65,7 +67,13 @@ def reset(
options: Optional[Dict[str, Any]] = None,
**kwargs
):
obs, info = self.env.reset(seed, options)

if seed is not None:
self.rand_seed = seed
else:
self.rand_seed += 1

obs, info = self.env.reset(self.rand_seed, options)
obs = self.convert_observation(obs)

return obs, info
Expand Down

0 comments on commit 2c70785

Please sign in to comment.