value-based-discrete-control
Use the repository's Char01 DQN family for discrete Gym control: CartPole, MountainCar, replay buffers, reward shaping, target-network updates, and TensorBoard logging.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- value-based-discrete-control
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use the repository's Char01 DQN family for discrete Gym control: CartPole, MountainCar, replay buffers, reward shaping, target-network updates, and TensorBoard logging.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/dqn-family-map.md6.0 KB
- 参考文档references/troubleshooting.md3.4 KB
- 脚本scripts/dqn_discrete_probe.py6.0 KB
03 SKILL.md 正文
Value-Based Discrete Control
Use this sub-skill for requests about the repository's Deep Q-Network examples in classic discrete-action Gym environments. It is a routing and operating guide for the Char01 DQN family, not a packaged training API.
Use when
- The user asks to run, adapt, or explain the CartPole DQN workflow.
- The user asks why MountainCar DQN is hard, how to shape its reward, or how to tune its replay/update settings.
- The user asks about the DQN replay buffer layout, sampling behavior, epsilon-greedy action selection, target network copy cadence, or TensorBoard loss/episode logs.
- The user needs a bounded compatibility probe for Gym classic-control + torch + tensorboardX before adapting a DQN script.
Route elsewhere
- Tabular Q-learning/Sarsa/GridWorld requests -> sibling
tabular-control. - REINFORCE, policy-gradient, actor-critic, A2C, or PPO requests -> sibling
on-policy-actor-critic. - DDPG, SAC, TD3, Pendulum, BipedalWalker, or continuous-action off-policy
requests -> sibling
off-policy-continuous-control. - Plot-only curve aggregation requests -> root/shared plotting support.
Runtime entry points
-
For a DQN-family decision or code adaptation, read
references/dqn-family-map.mdfirst. -
For failures, surprising learning curves, headless runs, TensorBoard output, or Gym-version issues, read
references/troubleshooting.md. -
For a bounded environment/API check, run the bundled inspection helper rather than launching a long training loop:
python sub-skills/value-based-discrete-control/scripts/dqn_discrete_probe.py --env CartPole-v0 --steps 3 python sub-skills/value-based-discrete-control/scripts/dqn_discrete_probe.py --env MountainCar-v0 --steps 3 --reward-shaping mountaincar-position-bonusThe helper performs no learning and never calls
render().
Source-script policy
The repository's DQN scripts are training-scale references, not safe default helpers. Treat them as distilled patterns:
DQN_CartPole-v0.pyandDQN_MountainCar-v0.py: list replay buffer, tensorboardX logging, target/act networks, long episode counts.DQN.py,naiveDQN.py, andDQN_mountain_car_v1.py: older numpy-ring-buffer variants with unconditional render/plot behavior; use for algorithm notes and reward-shaping clues only.
Do not run the original long loops by default. If a user explicitly asks to run training, first make it bounded: disable rendering, choose a writable logdir, reduce episodes/capacity for a smoke, and preserve old-Gym reset/step semantics or add a compatibility wrapper.
Fast operating checklist
- Identify env family: CartPole has dense-ish balance reward; MountainCar needs explicit discussion of sparse/step-penalty learning and shaping.
- Identify replay style: list replay (
capacity=8000,batch_size=256) versus numpy ring replay (MEMORY_CAPACITY=2000or20000). - Check learning gate: most variants do not update until replay memory is full.
- Check target sync cadence: target networks are hard-copied every 100 update or learn steps, depending on the variant.
- Keep runtime edits self-contained; do not depend on the original checkout.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).