keras-rl
Use legacy keras-rl reinforcement-learning agents, memories, policies, processors, callbacks, and safe smoke checks.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- keras-rl
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use legacy keras-rl reinforcement-learning agents, memories, policies, processors, callbacks, and safe smoke checks.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/install-and-compatibility.md3.8 KB
- 参考文档references/repo-provenance.md1.6 KB
- 参考文档references/repo-routing-metadata.json430 B
- 参考文档references/troubleshooting.md4.6 KB
03 SKILL.md 正文
keras-rl
Use this repo skill when a task involves the legacy keras-rl package: Keras 2.x reinforcement-learning agents, Gym-style environments, DQN/Double DQN/Dueling DQN, SARSA, CEM, DDPG, NAF/CDQN, replay memories, exploration policies, processors, callbacks, logging, or lightweight compatibility checks.
First checks
- Treat
keras-rlas legacy standalone Keras 2.x code. Do not assume modern Keras 3 or puretf.kerascompatibility. - Prefer a Keras-2-compatible backend stack for any real execution. A Theano CPU backend is often the safest compile-only route for this package family; TensorFlow-era imports can succeed while agent construction still fails on legacy symbolic-tensor assumptions.
- Install the package itself with one of:
pip install keras-rl
pip install "keras-rl[gym]" # when Gym examples or environments are needed
Additional workflow dependencies are separate: h5py for weight files, matplotlib for log plotting, wandb for WandbLogger, Atari extras/ROMs for Atari tasks, and MuJoCo system/license dependencies for MuJoCo tasks.
Minimal import check:
import rl
from rl.agents import DQNAgent, DDPGAgent, CEMAgent, SARSAAgent, NAFAgent
from rl.memory import SequentialMemory, EpisodeParameterMemory
from rl.policy import EpsGreedyQPolicy, BoltzmannQPolicy
For environment and backend diagnostics, use the checker linked from core-extension-and-logging before spending time on training.
Route by task
Discrete-action agents
Use discrete-control when the task names or implies:
- DQN, Double DQN, Dueling DQN, SARSA, CEM, CartPole, Atari-style DQN, or a discrete Gym action space.
SequentialMemory,EpisodeParameterMemory,EpsGreedyQPolicy,BoltzmannQPolicy,LinearAnnealedPolicy, replay warmup, target networks, or dueling aggregation.- A need to compile a safe discrete-agent smoke script without long training or rendering.
Continuous-action agents
Use continuous-control when the task names or implies:
- DDPG, NAF/CDQN, Pendulum, MuJoCo, continuous action spaces, actor/critic wiring,
critic_action_input,V_model,mu_model,L_model, or covariance modes. OrnsteinUhlenbeckProcess,GaussianWhiteNoiseProcess, continuous replay memory, action-noise sizing, or a compile-only continuous-agent smoke check.
Core lifecycle, processors, callbacks, and logging
Use core-extension-and-logging when the task involves:
Agent.fit,Agent.test, compile-before-fit errors, callback wiring,verbose,visualize,nb_max_episode_steps,action_repetition, orstart_step_policy.- Custom
ProcessororEnvimplementations,MultiInputProcessor,WhiteningNormalizerProcessor, Gym API adapters, or state-batch shape transformations. FileLogger,ModelIntervalCheckpoint,WandbLogger, log JSON plotting, environment compatibility checks,clone_model,clone_optimizer,huber_loss, orWhiteningNormalizer.
Cross-cutting references
- Read Repository Provenance before deciding whether this skill is current for a different checkout or after package code changes.
- Read Install and compatibility when imports, Keras backend setup, Gym optional dependencies, WandB, matplotlib, weight files, Atari, or MuJoCo requirements are uncertain.
- Read Troubleshooting for package-wide failure triage before drilling into a sub-skill-specific troubleshooting page.
Safe operating stance
- Prefer compile/build smoke checks before
fitortest. Full training examples can be long-running, display-dependent, or require external simulators. - Keep Atari and MuJoCo tasks explicitly optional unless the user has already installed the required extras, ROMs/data, system packages, and licenses.
- Do not use original repository examples as runtime dependencies. Use the bundled smoke helpers and references in this skill tree instead.
- For any workflow that spans agent construction and logging/lifecycle, start in the agent-family sub-skill, then cross-check
Agent.fit/callbacks incore-extension-and-logging.
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).