Spaces:
Running
Running
Download LightZero/zoo/atari/tests/test_atari_lightzero_env.py from OpenDILabCommunity/gomoku: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/spaces/OpenDILabCommunity/gomoku/resolve/main/LightZero/zoo/atari/tests/test_atari_lightzero_env.py
- Command line
-
hf download hf://spaces/OpenDILabCommunity/gomoku/LightZero/zoo/atari/tests/test_atari_lightzero_env.py
-
curl -L -o test_atari_lightzero_env.py https://huggingface.co/spaces/OpenDILabCommunity/gomoku/resolve/main/LightZero/zoo/atari/tests/test_atari_lightzero_env.py
1.08 kB
| import pytest | |
| from zoo.atari.envs.atari_lightzero_env import AtariLightZeroEnv | |
| from easydict import EasyDict | |
| config = EasyDict(dict( | |
| collector_env_num=8, | |
| evaluator_env_num=3, | |
| n_evaluator_episode=3, | |
| env_name='PongNoFrameskip-v4', | |
| env_type='Atari', | |
| obs_shape=(4, 96, 96), | |
| collect_max_episode_steps=int(1.08e5), | |
| eval_max_episode_steps=int(1.08e5), | |
| gray_scale=True, | |
| frame_skip=4, | |
| episode_life=True, | |
| clip_rewards=True, | |
| channel_last=True, | |
| render_mode_human=False, | |
| scale=True, | |
| warp_frame=True, | |
| save_video=False, | |
| transform2string=False, | |
| game_wrapper=True, | |
| manager=dict(shared_memory=False, ), | |
| stop_value=int(1e6), | |
| )) | |
| config.max_episode_steps = config.eval_max_episode_steps | |
| class TestAtariLightZeroEnv: | |
| def test_naive(self): | |
| env = AtariLightZeroEnv(config) | |
| env.reset() | |
| while True: | |
| action = env.random_action() | |
| obs, reward, done, info = env.step(action) | |
| if done: | |
| print(info) | |
| break |