Downloads · 30 days
12
17% of all-time downloads
hwihwalab/cartpole-v1-ppo
cartpole-v1-ppo is a reinforcement learning model from hwihwalab. Use it for the reinforcement learning task on the model card, and read the license before you ship it in a product. It is set up for stable-baselines3. The card lists the license as mit.
[](README.md) [](READMEKR.md) [](https://huggingface.co/spaces/hwihwalab/cartpole-v1-ppo)
Downloads · 30 days
12
17% of all-time downloads
All-time downloads
69
Public
Repo size
2.1 MB
Likes
0
Public
Click a slice to open those files.
.gif1.3 MB · 71%
From the Hugging Face model README
"Can Earth-Trained Reinforcement Learning Policies Survive Extraterrestrial Gravitational Shifts?"
A high-precision Physical AI & Robotics Dynamics Benchmark comparing Deep Neural PPO (Proximal Policy Optimization) against Classical Optimal LQR (Linear Quadratic Regulator) across 4 planetary gravitational regimes and dynamic physical disturbances.
🌐 English Documentation | 🇰🇷 한국어 매뉴얼 | 🎮 Live Interactive Web Demo
[!TIP] 🎮 Try Live in Browser (Zero Install): 👉 Open Hugging Face Spaces Live Demo
📦 Official Model Hub: 🤗 hwihwalab/cartpole-v1-ppo | 🐙 GitHub Repository: Hwihwa-Lab/cartpole-v1-ppo
👉 Launch Interactive Physical AI Lab Space
⚡ ±XX.X N) and watch the AI catch and rebalance the pole in real-time.| Input / Hotkey | Action | Description |
|---|---|---|
[ Mouse Drag / Click ] | External Impulse | Drag on canvas to aim laser vector and flick $\pm 5\text{N} \sim \pm 30\text{N}$ shock |
[ Space ] | START / PAUSE | Toggle 60FPS continuous physical dynamics engine |
[ R ] | RESET | Reset inverted pendulum state to nominal initial conditions |
[ M ] | SWITCH POLICY | Cycle controller mode: TRAINED PPO ➔ LQR ➔ UNDERCOOKED ➔ MANUAL |
[ ◀ / ▶ ] | MANUAL TELEOP | Apply direct manual left/right force commands to cart |
[ F ] | RANDOM SHOCK | Apply instant $\pm 10\text{N}$ shock impulse |
flowchart TB
subgraph Client_Layer ["🤖 Physical AI & Robotics Dynamics Suite (One-Screen Golden Ratio)"]
UI_Left["Left: Controller Arena (PPO vs LQR), 4-DOF Telemetry & Speed Dropdown"]
UI_Center["Center: 60FPS Canvas, Mouse Drag Force Vector & Phase Portrait Attractor"]
UI_Right["Right: Sim-to-Real Planetary Tuner (L, M, g) & Real-time Chart.js"]
end
subgraph Core_Engine ["⚡ Pure JS Physics & Controller Runtime (cartpole_sim.js)"]
Physics["Variable Physics Solver (Euler Integration with Dynamic L, M, g)"]
LQR_Ctrl["Classical Optimal LQR Controller (Riccati Gain Matrix u = -K*x)"]
PPO_Ctrl["Feed-Forward MLP Policy (Tanh x 2 -> Softmax Decision)"]
PhasePlot["Phase Plane Engine (θ vs θ̇ Orbital Spiral Trajectory)"]
WeightsJSON["Exported Neural Weights (cartpole_weights.json)"]
end
subgraph Python_Backend ["🐍 Python Training & Benchmark Infrastructure"]
Trainer["PPO Policy Trainer (train.py @ 25,000 steps)"]
Benchmark["Automated 1,800-Run Benchmark Engine (benchmark_experiments.py)"]
LocalServer["Zero-Dependency Local Launcher (run.py @ Port 8000)"]
TestSuite["Automated Test Harness (test_app.py - 6 Test Cases)"]
end
subgraph Hub_Distribution ["🌐 Hugging Face Universal Deployment (deploy_to_hf.py)"]
Spaces["HF Spaces (Static SDK Zero-Latency Web Benchmark)"]
Models["HF Model Hub (Weights, Benchmark JSON, Model Card)"]
end
WeightsJSON --> PPO_Ctrl
Physics --> UI_Center
PPO_Ctrl --> UI_Left
LQR_Ctrl --> UI_Left
PhasePlot --> UI_Center
Physics --> UI_Right
Trainer --> WeightsJSON
Benchmark --> Models
LocalServer --> Client_Layer
Client_Layer --> Spaces
Trainer --> Models
All empirical data below were generated across 1,800 physical evaluation episodes using our automated test harness (benchmark_experiments.py).
| Controller | 🌙 Moon (1.62 m/s²) | 🔴 Mars (3.72 m/s²) | 🌍 Earth (9.81 m/s²) | 🪐 Jupiter (24.79 m/s²) | Mean Angle Error |
|---|---|---|---|---|---|
| Trained PPO (20K) | 500.0 (100%) | 500.0 (100%) | 500.0 (100%) | 500.0 (100%) | 0.26° (Earth) / 0.53° (Jupiter) |
| Optimal LQR (Riccati) | 500.0 (100%) | 500.0 (100%) | 500.0 (100%) | 500.0 (100%) | 0.18° (Earth) / 0.42° (Jupiter) |
| Undercooked PPO (2K) | 21.7 (0%) | 21.7 (0%) | 19.3 (0%) | 18.6 (0%) | N/A (Premature Drop) |
| Controller | Nominal (Clean) | Wind Bias (+2.2N) | Sensor Noise (σ=0.05) | Combined Stress |
|---|---|---|---|---|
| Trained PPO (20K) | 500.0 (100%) | 500.0 (100%) | 500.0 (100%) | 500.0 (100%) |
| Optimal LQR (Riccati) | 500.0 (100%) | 500.0 (100%) | 500.0 (100%) | 500.0 (100%) |
| Undercooked PPO (2K) | 19.3 (0%) | 16.5 (0%) | 20.5 (0%) | 14.2 (0%) |
Based on continuous state-space trajectory logging across the 1,800 physical evaluation runs, each experimental regime exhibited distinct physical motion signatures:
🌍 Earth Nominal ($9.81,\text{m/s}^2$ · Symmetric Micro-Chattering):
🌙 Moon Low Gravity ($1.62,\text{m/s}^2$ · Floaty Wave Overshooting):
🪐 Jupiter Extreme Gravity ($24.79,\text{m/s}^2$ · High-Frequency Hyper-Stiffness):
💨 Lateral Wind Bias ($+2.2,\text{N}$ · Asymmetric Lean Counter-Steering):
⚡ External Perturbation Recovery (Two-Phase Counter-Steer & Settle):
| File Path | Single Responsibility Description |
|---|---|
models/cartpole_ppo.zip | Trained official PyTorch / Stable-Baselines3 PPO policy weights archive |
cartpole_weights.json | Standalone zero-dependency PPO MLP weights [Linear(4,64) ➔ Linear(64,64) ➔ Linear(64,2)] for in-browser 60FPS JS inference |
replay.mp4 | Official 1:1 square (720×720) high-definition video preview for Hugging Face model card |
index.html | High-density Cybernetic Bento Suite physical laboratory cockpit |
style.css | Neo-dark glassmorphic design system, responsive meters, and tactile controls |
cartpole_sim.js | 60FPS physics solver, PPO/LQR runtime, interactive drag perturbation & phase radar |
train.py | PPO policy trainer (25K steps) with automated JS weight exporter |
benchmark_experiments.py | Automated 1,800-run empirical Sim-to-Real planetary benchmark test pipeline |
benchmark_results.json | Full quantitative evaluation metrics across 4 planets and 3 disturbance regimes |
generate_trajectory_dataset.py | 77,821-step high-frequency state-action-torque physical trajectory generator |
run.py / run_desktop.py | Zero-dependency standalone application server and desktop GUI launcher |
deploy_to_hf.py | One-click triple deployment pipeline for Hugging Face Models, Spaces, and Datasets |
LICENSE | Official MIT open-source license |
python run.py
python benchmark_experiments.py
python test_app.py
This project represents Foundation Stage 1 in the Hwihwa Lab Physical AI & Robotics Series:
This project is licensed under the MIT License - see the LICENSE file for details.
Trained and deployed with CartPole Physical AI Lab by HWIHWA LAB.