TorchWM CLI#
The project exposes a small command-line interface for common developer tasks:
Run the CLI with:
python -m tools.cli <command>; after installing the package an installed entrypoint is available astorchwm <command>. Tests and plugin integrations may invoke the top-level Click app (tools.cli.app) or the console-script callable (tools.cli.run).The CLI uses Click directly and lazy imports to keep startup fast; some commands require optional dependencies (listed below).
Commands#
version- Print the installedtorchwmpackage version (or “unknown” if the package cannot be imported).envs list- List built-in environment backends and example environment ids. This reads the environment catalog fromworld_models.catalogif available.datasets list [PATH]- List dataset entries underPATH. IfPATHis not provided the command usesTORCHWM_HOMEor defaults to~/.torchwm.datasets convert <src> [--dest-format video] [--out-dir DIR]- Convert a simple dataset file into another format. The initial implementation supports converting HDF5 (.h5) or NumPy (.npz/.npy) datasets into MP4 video files (one file per episode) when--dest-format videois used. Output files are written to the specified--out-diror./converted_datasetsby default.collect --env <ENV_ID> [--steps N] [--out PATH] [--random-policy]- Run a (random) policy for a number of environment steps and save interactions to a compressed.npzwith keysobservations,actions,rewards,dones.train <model> [extra args...] [--inproc]- Launch an existing training entrypoint. The CLI maps simple model names to modules inworld_models.training(e.g.iris,planet,jepa,rssm,genie). By defaulttrainspawns a subprocess runningpython -m world_models.training.<name>and forwards any extra args. Use--inprocto attempt running the training entrypoint in-process (calls the module’smain()if available).models list- Print the known training entrypoints and (when available) exported model names fromworld_models.models.
Environment / optional dependencies#
TORCHWM_HOME - Directory used by
datasets listwhen no path is provided.The following commands require optional packages which may not be installed in all environments:
collect: requiresgym/gymnasiumandnumpy.datasets convert: requiresh5py,numpyand video helpers used by the repository.
Notes and examples#
Example: show version
torchwm version
Example: list environments
torchwm envs list
Example: list datasets in default location
torchwm datasets list
Example: convert a local HDF5 dataset to MP4 files
torchwm datasets convert data/my_dataset.h5 --out-dir /tmp/videos
Example: collect 1000 steps from Pong and save as
pong.npz
torchwm collect --env ALE/Pong-v5 --steps 1000 --out pong.npz
Example: run training for the
irisentrypoint in a subprocess
torchwm train iris -- --config configs/iris.yaml
Maintaining this page#
If you add or rename CLI commands in tools.cli, update this page with the
new usage, examples, and any additional optional dependencies.