|
!pip install git+https://github.com/DLR-RM/rl-baselines3-zoo@update/hf |
|
!pip install rl_zoo3==2.0.0a9 |
|
!apt-get install swig cmake ffmpeg |
|
!pip install gymnasium[atari] |
|
!pip install gymnasium[accept-rom-license] |
|
%%capture |
|
!apt install python-opengl |
|
!apt install xvfb |
|
!pip3 install pyvirtualdisplay |
|
|
|
from pyvirtualdisplay import Display |
|
|
|
virtual_display = Display(visible=0, size=(1400, 900)) |
|
virtual_display.start() |
|
!git clone https://github.com/DLR-RM/rl-baselines3-zoo.git |
|
%cd rl-baselines3-zoo |
|
import os |
|
|
|
|
|
os.makedirs("hyperparameters", exist_ok=True) |
|
|
|
|
|
config = """ |
|
BreakoutNoFrameskip-v4: |
|
env_wrapper: |
|
- stable_baselines3.common.atari_wrappers.AtariWrapper |
|
frame_stack: 4 |
|
policy: 'CnnPolicy' |
|
n_timesteps: !!float 1e5 |
|
buffer_size: 100000 |
|
learning_rate: !!float 1e-4 |
|
batch_size: 32 |
|
learning_starts: 100000 |
|
target_update_interval: 1000 |
|
train_freq: 4 |
|
gradient_steps: 1 |
|
exploration_fraction: 0.1 |
|
exploration_final_eps: 0.01 |
|
policy_kwargs: 'dict(net_arch=[256, 256])' |
|
optimize_memory_usage: False |
|
""" |
|
|
|
|
|
with open("hyperparameters/dqn.yml", "w") as file: |
|
file.write(config) |
|
|
|
|
|
!python -m rl_zoo3.train --algo dqn --env BreakoutNoFrameskip-v4 -conf hyperparameters/dqn.yml -f logs/ |
|
!python -m rl_zoo3.enjoy --algo dqn --env BreakoutNoFrameskip-v4 --no-render --n-timesteps 5000 --folder logs/ |
|
!python -m rl_zoo3.push_to_hub --algo dqn --env BreakoutNoFrameskip-v4 --repo-name dqn-BreakoutNoFrameskip-v4_2 -orga ajlao -f logs/ |