Skip to content

feat: package RL CLIs and deployment profile plugins - #133

Merged
wlgys8 merged 2 commits into
mainfrom
131-package-mxtrain-mxplay
Oct 18, 2026
Merged

wlgys8 merged 2 commits into
mainfrom
131-package-mxtrain-mxplay

Conversation

@wlgys8

@wlgys8 wlgys8 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #131.

  • Package training and playback as installed mxtrain / mxplay commands, and export as explicit mxexport onnx / mxexport deploy subcommands. Preserve repository scripts as thin wrappers.
  • Ship generic Hydra entry configurations and shared algorithm defaults with motrix_rl; keep concrete task presets in workspace configs/task. Discover launch-directory ./configs by default, honor explicit --config-dir, and prioritize project files over packaged fallbacks.
  • Support explicit environment registration modules for train/play without coupling the environment layer to training configuration.
  • Discover deployment profile compilers through motrix_deploy.profile_compilers package entry points, keyed by exact environment name. Load only the selected compiler, reject duplicate providers, and remove hardcoded builtin-environment imports from deployment export. Preserve the one-way motrix_rl -> motrix_deploy dependency.
  • Migrate bilingual documentation, Docker/demo usage, and tests; remove the unused GPU utility.

Usage

mxtrain task=cartpole/skrl.ppo
mxplay env=cartpole policy=/path/to/policy.pt
mxexport onnx run_dir=/path/to/run output=/tmp/policy.onnx
mxexport deploy run_dir=/path/to/run output=artifacts/policy.deploy
mxexport deploy env=go2-walk-rough

mxexport requires an explicit format. Deployment export selects exactly one of run_dir or env. Installed environment packages declare their profile compilers; external projects do not need to import motrix_envs.

Validation

  • RL/provider/workspace suites (not slow and not numba): 504 passed, 2 skipped, 21 deselected.
  • Deployment core suite: 255 passed.
  • Deployment task + environment-profile suites: 171 passed.
  • prek run --all-files and whitespace checks passed.
  • Built wheels for motrix_rl, motrix_deploy, and motrix_envs; installed them without dependency replacement into an acceptance environment reusing existing dependencies. Verified command help, packaged configuration loading outside the checkout, and builtin Go2 compiler discovery/build.
  • Actual installed mxexport deploy exported a synthetic SKRL-format checkpoint using an external compiler/task package entry point, with an active guard rejecting all motrix_envs imports. Artifact parsing, payload checksums, ONNX checker, and CPU inference passed; four-sample parity maximum absolute error was 1.1920928955078125e-07.
  • Actual ONNX export and project-first configuration behavior are covered by integration tests. Independent implementation review found no confirmed actionable defects.

Limitations

  • Acceptance reused installed dependencies; it is not a clean dependency-closure installation test.
  • Export acceptance used a synthetic checkpoint, not a trained rollout. No GPU training or physical-robot deployment was performed.
  • Strict bilingual Sphinx builds could not run because Sphinx is absent; rendered HTML remains unverified.

Base

Rebased onto main after parent PR #130 was squash-merged, so this PR contains only the CLI/configuration/export-plugin migration.

@wlgys8
wlgys8 force-pushed the 131-package-mxtrain-mxplay branch from c4eef3e to 4d43e6c Compare October 17, 2026 17:53
@wlgys8
wlgys8 requested a balanced review from Copilot October 17, 2026 17:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It spans CLI packaging, a dependency-direction-sensitive entry-point migration, config relocation, and bilingual doc/Docker changes whose packaging and plugin-discovery behavior warrant final human verification.

No open issues 🎉

What changed in this PR

This PR packages the RL control-plane CLIs as installed console scripts (mxtrain, mxplay, mxexport onnx/mxexport deploy) and ships generic Hydra entry configs and shared algo_base defaults inside motrix_rl.configs, keeping concrete task presets in the workspace configs/task. It implements project-first config discovery (launch-directory ./configs, explicit --config-dir, packaged fallback) via a Hydra SearchPathPlugin, decouples environment registration from training config through explicit env_modules, and migrates deployment profile-compiler discovery from an in-process decorator registry to the motrix_deploy.profiles entry-point group keyed by exact environment name. Repository scripts/ become thin wrappers, bilingual docs/Docker/demo usage are updated, and the unused GPU utility is removed.

Changes:

  • Add mxtrain/mxplay/mxexport console scripts and package their Hydra configs in motrix_rl.configs, with project-first ./configs discovery and explicit env_modules environment registration.
  • Replace the register_profile_compiler decorator registry with motrix_deploy.profiles entry-point discovery (exact-name match, reject duplicates, load only the selected compiler), removing hardcoded motrix_envs imports from export.
  • Migrate tests, bilingual documentation, Docker/demo usage, and the DeploymentExportConfig.run → run_dir rename to the new command surface.
File Description
wiki/​design/​motrix-deploy.md Documents entry-point profile discovery and the new mxexport deploy entry/dependency direction.
tests/​test_task_configs.py Composes against packaged motrix_rl.configs with a hydra.searchpath to project configs.
tests/​test_rl_commands.py New integration tests for installed command composition, project-first config, and help/override behavior.
tests/​test_plugin_export_integration.py Adds subprocess integration test for mxexport onnx parity outside the workspace.
tests/​test_play_script.py Imports the packaged motrix_rl.commands.play instead of loading the repo script by path.
tests/​test_doc_generate_video_script.py Updates expected train command to python -m motrix_rl.commands.train.
tests/​test_deploy_export_cli.py Uses packaged config module, export_deploy command, and run_dir selector rename.
tests/​test_cli_config.py Switches train/play/export_onnx composition to the packaged config module with project searchpath.
scripts/​train.py Reduced to a thin wrapper over the packaged command (truncated in diff).

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It is a broad cross-package migration altering packaging, entry-point discovery, plugin boundaries, and config schemas across ~90 files, which warrants final human review despite no concrete defects being found.

No open issues 🎉

Review effort: Balanced

@wlgys8
wlgys8 force-pushed the 131-package-mxtrain-mxplay branch from 1143cff to 069ed6d Compare October 18, 2026 05:36
@wlgys8
wlgys8 force-pushed the 131-package-mxtrain-mxplay branch from 069ed6d to ca5baa5 Compare October 18, 2026 05:47
@wlgys8
wlgys8 merged commit bdf403f into main Oct 18, 2026
8 checks passed
@wlgys8
wlgys8 deleted the 131-package-mxtrain-mxplay branch October 18, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: 将训练和播放入口内置为 motrix_rl 的 mxtrain / mxplay 命令

2 participants