Reinforcement Learning
stable-baselines3
SpaceInvadersNoFrameskip-v4
deep-reinforcement-learning
Eval Results (legacy)
Instructions to use seynath/SpaceInvadersNoFrameskip-v4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- stable-baselines3
How to use seynath/SpaceInvadersNoFrameskip-v4 with stable-baselines3:
from huggingface_sb3 import load_from_hub checkpoint = load_from_hub( repo_id="seynath/SpaceInvadersNoFrameskip-v4", filename="{MODEL FILENAME}.zip", ) - Notebooks
- Google Colab
- Kaggle
Download wrappers/initial_step_truncate_wrapper.py from seynath/SpaceInvadersNoFrameskip-v4: direct link, hf CLI and curl.
- Browser
- Download file 948 Bytes
-
https://huggingface.co/seynath/SpaceInvadersNoFrameskip-v4/resolve/main/wrappers/initial_step_truncate_wrapper.py
- Command line
-
hf download hf://seynath/SpaceInvadersNoFrameskip-v4/wrappers/initial_step_truncate_wrapper.py
-
curl -L -o initial_step_truncate_wrapper.py https://huggingface.co/seynath/SpaceInvadersNoFrameskip-v4/resolve/main/wrappers/initial_step_truncate_wrapper.py
948 Bytes
| import gym | |
| import numpy as np | |
| from gym.wrappers.monitoring.video_recorder import VideoRecorder | |
| from typing import Any, Dict, Tuple, Union | |
| ObsType = Union[np.ndarray, dict] | |
| ActType = Union[int, float, np.ndarray, dict] | |
| class InitialStepTruncateWrapper(gym.Wrapper): | |
| def __init__(self, env: gym.Env, initial_steps_to_truncate: int) -> None: | |
| super().__init__(env) | |
| self.initial_steps_to_truncate = initial_steps_to_truncate | |
| self.initialized = initial_steps_to_truncate == 0 | |
| self.steps = 0 | |
| def step(self, action: ActType) -> Tuple[ObsType, float, bool, Dict[str, Any]]: | |
| obs, rew, done, info = self.env.step(action) | |
| if not self.initialized: | |
| self.steps += 1 | |
| if self.steps >= self.initial_steps_to_truncate: | |
| print(f"Truncation at {self.steps} steps") | |
| done = True | |
| self.initialized = True | |
| return obs, rew, done, info | |