environments
Discover, select, and safely control MyoSuite Gymnasium environments on the base CPU backend.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- environments
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Discover, select, and safely control MyoSuite Gymnasium environments on the base CPU backend.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md7.1 KB
- 参考文档references/task-catalog.md5.0 KB
- 参考文档references/troubleshooting.md4.5 KB
- 脚本scripts/environment_smoke.py4.7 KB
03 SKILL.md 正文
MyoSuite environments
Use this sub-skill when a user needs to install the base package, identify a registered task, create an environment, run a short reset/step rollout, inspect its spaces or diagnostics, seed it, or close it cleanly. Start with a named registered environment rather than guessing a model filename.
Route the request
- Core import, Gymnasium registration, task IDs, reset/step, spaces, rewards,
info, seeding, lifecycle, or safe no-display inspection: handle here. - Viewer/window behavior and MuJoCo rendering internals: route to
simulation-rendering. - Model XML editing, IK, or task-specific kinematic changes: route to
model-editing-kinematics. - Reference trajectories or playback: route to
reference-motion. - JAX/MJX execution: route to
mjx-acceleration; do not imply that a CPU smoke proves MJX or CUDA support. - Long training commands and learner configuration: route to
training-integration.
See the API reference for the full contract, the task catalog for selection, and troubleshooting when setup or assets fail.
Base prerequisites
The supported base route is Python 3.10–3.13 with the package's normal runtime dependencies, including Gymnasium below 1.3, MuJoCo 3.6.x, NumPy, Click, and the package data. The verified inspection combination was Python 3.11, MyoSuite 2.12.2, MuJoCo 3.6.0, and Gymnasium 1.2.3. Install the released package into an isolated environment, or use the project's documented source installation with all required model assets initialized. Do not install the MJX/CUDA extras just to run this core route.
Importing myosuite imports the package's Gym compatibility helper and then
registers its task suites. If neither gymnasium nor the legacy gym package
is importable, import fails before an environment can be made. Prefer
Gymnasium for new code.
Fast path: named, headless rollout
For a standard CPU check, run the bundled safe smoke script:
python sub-skills/environments/scripts/environment_smoke.py \
--env-id myoElbowPose1D6MRandom-v0 --steps 3 --seed 123 --render none
The script only creates the requested environment, samples bounded actions,
uses reset(seed=...), performs bounded steps, prints contract summaries, and
always calls close(). It does not open a viewer, evaluate policy files,
write videos, fetch assets, or execute arbitrary environment arguments. Add
--check-determinism to repeat the short rollout with the same reset and
action-space seeds.
The equivalent minimal Python pattern is:
from myosuite.utils import gym
env = gym.make("myoElbowPose1D6MRandom-v0")
try:
env.action_space.seed(123)
observation, info = env.reset(seed=123)
for _ in range(3):
observation, reward, terminated, truncated, info = env.step(
env.action_space.sample()
)
if terminated or truncated:
break
finally:
env.close()
Do not call mj_render() in a no-display workflow. gym.make normally returns
Gymnasium wrappers; use env.unwrapped only when the user explicitly needs
MyoSuite internals such as get_obs_dict, get_reward_dict, get_proprioception,
get_exteroception, horizon, or get_env_state.
Discover before creating
- Import
myosuiteso registration side effects have run. - Prefer an exact ID from the task catalog.
- Check
gym.spec(task_id)beforegym.make(task_id); an unknown ID is a selection error, not an installation fix. - Read
spec.max_episode_stepsfor the wrapper horizon. Core registrations include fixed/random tasks and automatically registeredSarcandFativariants; hand tasks also haveReafvariants. - If the name is uncertain, list
myosuite.myosuite_env_suiteor filtergym.envs.registry.keys()instead of probing arbitrary strings.
A valid registry entry does not prove that every model asset can be loaded.
Only gym.make followed by reset establishes that the selected model is
usable in the current installation.
Lifecycle and contracts
env = gym.make(id, **kwargs)creates a wrapped task. Keep construction kwargs limited to documented task options; do not pass untrusted strings to an evaluator.env.reset(seed=seed)returns(observation, info)under Gymnasium. Seed the action space separately withenv.action_space.seed(seed)when comparing random-policy rollouts. A legacy Gym installation may return only an observation; follow the installed API rather than unpacking blindly.env.step(action)returns(observation, reward, terminated, truncated, info). Stop on either boolean; the wrapper enforces the registered time limit throughtruncated, while a task's reward dictionary can produceterminated.actionmust fitenv.action_space, normally a float32Box. Sampling fromaction_spaceis safer than hand-building controls. Myo muscle tasks may internally map normalized controls before MuJoCo advances.observationis normally a flat NumPy vector inobservation_space. Its task-specific fields can be inspected through the unwrapped task'sobs_dict; do not assume all tasks expose the same keys or dimension.rewardis the configured dense reward scalar by default.infocontains MyoSuite diagnostics such astime,rwd_dense,rwd_sparse,solved,done,obs_dict,rwd_dict,proprio_dict,visual_dict, andstate. Treat nested arrays as owned by the environment and copy them before storing.- Always call
env.close()infinally, including after failed reset, step, or inspection. Avoid creating a viewer merely to inspect spaces.
Safe inspection
Use environment_smoke.py --list for a registry snapshot and
python -m myosuite.utils.examine_env --help to inspect the supported CLI
surface. The upstream CLI can run random or supplied policies and supports
--render none, but it also supports output/video options and policy loading;
use it only with trusted inputs and bounded episode counts. The bundled smoke
script is preferred for automated checks.
For deeper CPU inspection, after a successful reset/step use only public
methods: env.unwrapped.get_obs_dict(...), get_reward_dict(...),
get_proprioception(), get_exteroception(), get_env_infos(), and
get_env_state(). Route image capture or viewer setup away from this skill.
Verification evidence and limits
The base import and a myoElbowPose1D6MRandom-v0 reset/step smoke passed in the
private Python 3.11 inspection environment after the repository's five MuJoCo
asset submodules were initialized. The source README/minimal example, package
initializers, environment base, Myo base/task registrations, task catalog,
core environment tests, and examine_env --help define the claims in the
linked references. Native candidates for later verification are a single pose
reset/step lifecycle, selected core checks from test_myo/test_envs, and
examine_env --help. Optional MJX/JAX/CUDA and display-backed rendering remain
separate, explicitly unverified routes.
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).