force_training
Launch a new ML-Agents training run as a background process, overwriting previous results for the specified run ID. Blocks until the Unity environment is ready to train.
Instructions
Launch a new mlagents-learn training run as a background process. Always overwrites previous results for the same run_id. To continue from a checkpoint, use resume_training instead.
By default, blocks until ready: in editor mode (no env_path), waits until mlagents-learn says 'Listening on port... press Play'. In batch mode (with env_path), waits until the executable connects.
Args: config_path: Path to the YAML training config file. run_id: Unique identifier for this training run. env_path: Path to a built Unity environment executable. Omit to use the Unity Editor. num_envs: Number of parallel Unity environment instances. no_graphics: Disable graphics rendering for faster training. torch_device: PyTorch device (e.g. 'cuda', 'cpu', 'cuda:0'). seed: Random seed (-1 for random). time_scale: Unity time scale multiplier. base_port: Base port for Unity communication (auto-assigned if omitted). wait: Block until ready (default true). Editor mode: waits for 'press Play'. Batch mode: waits for connection. wait_timeout: Max seconds to wait when wait=true.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | ||
| wait | No | ||
| run_id | Yes | ||
| env_path | No | ||
| num_envs | No | ||
| base_port | No | ||
| time_scale | No | ||
| config_path | Yes | ||
| no_graphics | No | ||
| torch_device | No | ||
| wait_timeout | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||