Views
No views yet
A trained reinforcement learning agent for the Untitled Tower Defense Game using MaskablePPO.
| Parameter | Value |
|---|---|
| Total Timesteps | 0 |
| Learning Rate | 0.0003 |
| N Steps | 2048 |
| Batch Size | 64 |
| N Epochs | 10 |
| Gamma (γ) | 0.99 |
| GAE Lambda (λ) | 0.95 |
| Clip Range | 0.2 |
| Entropy Coefficient | 0.001 |
| Value Function Coefficient | 0.5 |
1from huggingface_hub import hf_hub_download
2from sb3_contrib import MaskablePPO
3
4# Download the model from Hugging Face Hub
5model_path = hf_hub_download(
6 repo_id="chrisjcc/utdg-maskableppo-policy",
7 filename="model_policy_v0.3.5.zip"
8)
9
10# Load the trained model
11model = MaskablePPO.load(model_path)1import gymnasium as gym
2from sb3_contrib import MaskablePPO
3
4# Assuming you have the UTDG environment installed
5# from utdg_env import UTDGEnv
6
7# Load model
8model = MaskablePPO.load(model_path)
9
10# Create environment
11env = gym.make("UTDGEnv-v0")
12obs, info = env.reset()
13
14# Run inference loop
15done = False
16total_reward = 0
17
18while not done:
19 # Get action mask from environment info
20 action_masks = info.get("action_mask", None)
21
22 # Predict action with masking
23 action, _states = model.predict(
24 obs,
25 action_masks=action_masks,
26 deterministic=True # Set False for stochastic behavior
27 )
28
29 # Step environment
30 obs, reward, terminated, truncated, info = env.step(action)
31 done = terminated or truncated
32 total_reward += reward
33
34print(f"Episode reward: {total_reward}")
35env.close()1from sb3_contrib import MaskablePPO
2
3# Load from a specific branch/revision
4model = MaskablePPO.load(
5 "chrisjcc/utdg-maskableppo-policy",
6 revision="production" # or "main", specific commit hash, etc.
7)| File | Description |
|---|---|
model_policy_v0.3.5.zip | Trained MaskablePPO model checkpoint (SB3 format) |
README.md | This model card with full documentation |
config.yaml | Hydra configuration snapshot (if included) |
1@misc{utdg-maskableppo,
2 author = {Chris Cadonic},
3 title = {UTDG MaskablePPO Agent},
4 year = {2025},
5 publisher = {Hugging Face},
6 howpublished = {\url{https://huggingface.co/chrisjcc/utdg-maskableppo-policy}}
7}