stable-baselines3
यह क्या करती है
यह tool AI 'agents' को simulated environments में फैसले लेना सिखाने में मदद करता है। यह reinforcement learning algorithms इस्तेमाल करता है, ताकि agents अनुभव के साथ बेहतर होते जाएँ।
कब इस्तेमाल करें
- ✓जब आप एक virtual robot को चलना सिखाना चाहते हैं।
- ✓ऐसा game बनाने के लिए जिसमें एक character खुद खेलना सीखे।
- ✓जटिल simulations में strategies परखने के लिए।
Skill का लिंक
https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/stable-baselines3/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“PPO algorithm का इस्तेमाल करके एक agent को Pac-Man खेलना सिखाओ।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
आप वह environment तय करते हैं जहाँ agent सीखेगा, और एक algorithm चुनते हैं। फिर tool training चलाता है, जिससे agent इनाम पाने के लिए अपने actions बदलता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Stable Baselines3
Overview
Stable Baselines3 (SB3) is a PyTorch-based library providing reliable implementations of reinforcement learning algorithms. This skill provides comprehensive guidance for training RL agents, creating custom environments, implementing callbacks, and optimizing training workflows using SB3's unified API.
Current upstream: SB3 2.9.0 (June 15, 2026). Docs: stable-baselines3.readthedocs.io.
Installation
Tested against stable-baselines3 2.9.0. Requires Python 3.10+ (3.9 dropped in 2.8.0) and PyTorch >= 2.8.
# Basic installation
uv pip install "stable-baselines3==2.9.0"
# With extra dependencies (TensorBoard, ale-py for Atari, etc.)
uv pip install "stable-baselines3[extra]==2.9.0"
The 2.9.0 release supports Gymnasium >=0.29.1,<2.0; this review exercised Gymnasium 1.3.0, PyTorch 2.14.1 and Python 3.13 on CPU. pandas/matplotlib are now optional extras. Installation requires network unless packages are cached; local RL training needs no credentials or service endpoints.
On zsh, quote brackets: uv pip install 'stable-baselines3[extra]==2.9.0'.
For MuJoCo continuous-control benchmarks:
uv pip install "gymnasium[mujoco]"
Check your version:
import stable_baselines3
print(stable_baselines3.__version__)
Related Projects
- SB3-Contrib: experimental algorithms (MaskablePPO, CrossQ, QR-DQN, RecurrentPPO) — separate
sb3-contribpackage - RL Baselines3 Zoo: pre-trained agents, hyperparameters, training scripts
- SBX: SB3 + JAX implementations for users who prefer JAX over PyTorch
Core Capabilities
1. Training RL Agents
Basic Training Pattern:
import gymnasium as gym
from stable_baselines3 import PPO
# Create environment
env = gym.make("CartPole-v1")
# Initialize agent (device="cpu" is often faster for MlpPolicy on small envs)
model = PPO("MlpPolicy", env, verbose=1, device="cpu", seed=0)
# Train the agent
model.learn(total_timesteps=10000)
# Save the model
model.save("ppo_cartpole")
# Load the model (without prior instantiation)
model = PPO.load("ppo_cartpole", env=env, device="cpu")
env.close()
Important Notes:
total_timestepsis a lower bound; actual training may exceed this due to batch collection- Call the class method
PPO.load(...)and keep the returned new model - The replay buffer is NOT saved with the model to save space
Algorithm Selection:
Use references/algorithms.md for detailed algorithm characteristics and selection guidance. Quick reference:
- PPO/A2C: General-purpose, supports Box, Discrete, flat MultiDiscrete and MultiBinary actions, good for multiprocessing
- SAC/TD3: Continuous control, off-policy, sample-efficient
- DQN: Discrete actions, off-policy
- HER: Replay-buffer strategy for goal-conditioned off-policy tasks
See scripts/train_rl_agent.py for a complete training template with best practices.
2. Custom Environments
Requirements:
Custom environments must inherit from gymnasium.Env and implement:
__init__(): Define action_space and observation_spacereset(seed, options): Return initial observation and info dictstep(action): Return observation, reward, terminated, truncated, inforender(): Visualization (optional)close(): Cleanup resources
Key Constraints:
- Default CNN image preprocessing expects
np.uint8in range [0, 255] - Use channel-first format when possible (channels, height, width)
- SB3 normalizes images automatically by dividing by 255
- For pre-normalized float images, use channel-first layout and
policy_kwargs={"normalize_images": False} - SB3 does NOT support
DiscreteorMultiDiscretespaces withstart!=0
Validation:
from stable_baselines3.common.env_checker import check_env
check_env(env, warn=True)
See the template and environment guide.
The template now observes both agent and random goal coordinates, shape (4,);
old shape (2,) checkpoints require retraining. gym.make("CustomEnv-v0") adds
the 100-step time limit; direct CustomEnv() does not. check_env checks API
consistency, not Markov sufficiency, reward correctness or learnability.
…
अक्सर पूछे जाने वाले सवाल
'reinforcement learning' क्या है?
यह machine learning का एक तरीका है जिसमें agent अपने actions के लिए इनाम या सज़ा पाकर फैसले लेना सीखता है।
'custom environments' क्या होते हैं?
ये वे simulations हैं जो आप खुद बनाते हैं, ताकि agent को ऐसी खास स्थितियों में train किया जा सके जो आसानी से उपलब्ध नहीं होतीं।
'vectorized environments' क्यों इस्तेमाल करें?
ये एक साथ कई simulations चलाने देते हैं, जिससे agent की training काफ़ी तेज़ हो जाती है।
जानकारी
लेखक का मूल विवरण
Trains and evaluates single-agent reinforcement learning with Stable Baselines3 (PPO, SAC, DQN, TD3, DDPG, A2C), Gymnasium custom environments, vectorized rollouts, callbacks, and checkpoint normalization. Applies to reproducible RL experiments, continuous control, discrete actions, and SB3-Contrib recurrent or masked policies.
लोकप्रियता
- GitHub स्टार
- 51k
- रैंकिंग में स्थान
- #3575
- लाइसेंस
- MIT
- अपडेट की गई
- 15/10/2026
कमेंट
- …
इस repository की और skills
13c-metabolic-flux
51kकार्बन-13 आइसोटोप ट्रेसिंग डेटा से मेटाबोलिक फ़्लक्स का अनुमान लगाता है। कोशिका के मेटाबॉलिज़्म और बायोकेमिकल मार्गों का विश्लेषण करने के लिए यह उपयोगी है।
adaptyv
51kAdaptyv API का उपयोग करके प्रोटीन कैरेक्टराइज़ेशन प्रयोग डिज़ाइन करता है। लागत का अनुमान लगाने, सीक्वेंस सबमिट करने और लैब के नतीजों पर नज़र रखने में मदद करता है।
aeon
51kटाइम सीरीज़ डेटा पर मशीन लर्निंग के काम करता है। क्रमबद्ध डेटा में वर्गीकरण, पूर्वानुमान, एनोमली डिटेक्शन और पैटर्न खोजने के लिए यह उपयोगी है।
alphagenome
51kजेनेटिक वेरिएंट्स के पहले से गणना किए गए जीनोमिक प्रभाव देखता है। वेरिएंट का जीनोम पर असर समझने के लिए स्कोर और स्पष्टीकरण देता है।
मिलती-जुलती skills
add-model-provider
394kयह आपके एजेंट को सुरक्षित कमांड से OpenClaw में नया AI मॉडल प्रोवाइडर जोड़ने, API कीज़ को सादे टेक्स्ट से बचाने और लाइव टेस्ट चलाने देती है।
acp-router
394kयह आपके एजेंट को OpenClaw के ज़रिए Claude Code या Cursor जैसे कोडिंग असिस्टेंट को काम भेजने देती है, ताकि काम उसी टूल में चले।
browser-automation
394kयह आपके एजेंट को लॉगिन, टैब और अटकी वेब पेज से उबरने समेत, वेबसाइट पर चरण-दर-चरण काम करना सिखाती है।