Downloads · 30 days
0
Guccimam/lunar-dqn
lunar-dqn is a reinforcement learning model from Guccimam. Use it for the reinforcement learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This repository contains a trained Dueling Double Deep Q-Network (Dueling Double DQN) PyTorch model for OpenAI Gymnasium's LunarLander-v3 environment.
Downloads · 30 days
0
Access
Public
Updated Aug 21, 2026
Repo size
285 KB
Likes
0
Public
Click a slice to open those files.
.pth285 KB · 97%
From the Hugging Face model README
This repository contains a trained Dueling Double Deep Q-Network (Dueling Double DQN) PyTorch model for OpenAI Gymnasium's LunarLander-v3 environment.
LunarLander-v3checkpoint_best.pth: PyTorch trained model weights (Best checkpoint)model.py: PyTorch DuelingQNetwork architectureagent.py: DQN Agent and ReplayBuffer implementationimport torch
import gymnasium as gym
from model import DuelingQNetwork
# 1. Initialize LunarLander environment
env = gym.make("LunarLander-v3", render_mode="human")
state, _ = env.reset(seed=42)
# 2. Instantiate Network & Load Weights
model = DuelingQNetwork(state_size=8, action_size=4)
model.load_state_dict(torch.load("checkpoint_best.pth", map_location="cpu"))
model.eval()
# 3. Run Evaluation Episode
done = False
total_reward = 0
while not done:
state_tensor = torch.from_numpy(state).float().unsqueeze(0)
with torch.no_grad():
q_values = model(state_tensor)
action = q_values.argmax(dim=-1).item()
state, reward, terminated, truncated, _ = env.step(action)
done = terminated or truncated
total_reward += reward
print(f"Touchdown Episode Completed! Total Reward: {total_reward:.2f}")
env.close()