--- tags: - SpaceInvadersNoFrameskip-v4 - deep-rl-course - dqn - reinforcement-learning - stable-baselines3 model-index: - name: DQN results: - task: type: reinforcement-learning name: reinforcement-learning dataset: name: SpaceInvadersNoFrameskip-v4 type: SpaceInvadersNoFrameskip-v4 metrics: - type: mean_reward value: 340.50 +/- 45.20 name: mean_reward verified: false --- # DQN Agent playing SpaceInvadersNoFrameskip-v4 👾 This is a trained DQN agent playing SpaceInvadersNoFrameskip-v4. **This model was trained as part of the Hugging Face Deep RL Course Unit 3.** ## Training Details - **Algorithm**: Deep Q-Network (DQN) - **Environment**: SpaceInvadersNoFrameskip-v4 (Atari) - **Library**: Stable Baselines3 - **Training timesteps**: 1,000,000 - **Evaluation**: 340.50 +/- 45.20 (10 episodes) ## Usage ```python from stable_baselines3 import DQN from stable_baselines3.common.env_util import make_atari_env from stable_baselines3.common.vec_env import VecFrameStack # Create environment env = make_atari_env('SpaceInvadersNoFrameskip-v4', n_envs=1) env = VecFrameStack(env, n_stack=4) # Load the model model = DQN.load("dqn-SpaceInvadersNoFrameskip-v4", env=env) # Enjoy trained agent obs = env.reset() for i in range(1000): action, _states = model.predict(obs, deterministic=True) obs, rewards, dones, info = env.step(action) env.render() ``` This model achieves good performance on the SpaceInvaders Atari game, scoring well above the target score of 200 for the Deep RL Course Unit 3.