View on GitHub
"```python\nfrom modal_training_gym.common.train import TrainConfig\n```\n\nCompose dataset, model, and recipe into one training entrypoint.\n\n## Fields\n\n| Field | Type | Default | Description |\n|-------|------|---------|-------------|\n| `dataset` | `DatasetConfig` | | The training dataset. `train()` materializes it into the framework's `/data` volume before training if it isn't already present. |\n| `model` | `ModelConfig` | | The model to train. Carries model identity (`model_name`) and weight-download logic; weights are downloaded into the shared HuggingFace cache volume on first use and reused across runs. |\n| `recipe` | `modal_training_gym.train_recipes.base.BaseTrainRecipe` | | Framework recipe (`SlimeRecipe` or `MilesConfig`). Selects the training framework and carries Modal infra settings (GPU type, node count, image) plus framework CLI flags. |\n| `checkpoint` | `modal_training_gym.common.checkpoint.Checkpoint \\| None` | `None` | Checkpoint to resume training from. When `None`, training starts from the base model weights. Default `None`. |\n| `merge_model_recipe` | `bool` | `True` | When `True`, merges the known-model preset recipe (e.g. `Qwen3_4b_Recipe`) onto recipe fields you left unset. Set `False` to run the recipe exactly as written, with no preset defaults. Default `True`. |\n| `detach` | `bool` | `True` | Run the training app detached so it keeps running on Modal even if the local client disconnects (terminal closed, laptop asleep). Set `False` for an attached run that stops on Ctrl-C. Default `True`. |\n| `group_id` | `str \\| None` | `None` | Shared sweep id. Set by `TrainingGroup` so every run in a sweep carries the same id, letting the dashboard group variants together. Not usually set by hand. Default `None`. |\n| `group_overrides` | `dict[str, Any] \\| None` | `None` | Per-variant parameter overrides applied by `TrainingGroup`, keyed by dotted field path (e.g. `{\"recipe.lr\": 1e-5}`). Recorded in run metadata so the dashboard can label each variant. Default `None`. |\n| `group_axes` | `list[str] \\| None` | `None` | Names of the swept parameter paths in a `TrainingGroup` grid. Recorded in run metadata for dashboard grouping; falls back to the keys of `group_overrides` when unset. Default `None`. |\n\n## Methods\n\n### `context_plan_line(self) -> str | None`\n\nOne-line summary of the effective training context length and parallelism plan.\n\n### `launch(self, *, show_output: bool = True, prepare_inputs: bool = False) -> modal_training_gym.common.run.TrainingRun`\n\nStart training in a detached Modal app and return immediately.\n\n### `train(self, *, show_output: bool = True) -> modal_training_gym.common.train_result.TrainResult`\n\nBuild the app, run training, and return the TrainResult.\n\n## Related Tutorials\n\n- [Qwen3-4B haiku evaluation with verifiable rewards — serve, evaluate, train, compare](/tutorials/rl/000_rl_basics/)\n- [Code RL with Harbor hello-world and sandboxed verification](/tutorials/rl/001_sandboxes/)\n- [Multi-turn number-guessing RL with custom generate and reward functions](/tutorials/rl/002_multiturn/)\n- [On-policy distillation on math — Qwen3-8B teacher, Qwen3-4B student](/tutorials/rl/003_on_policy_distillation/)\n- [DAPO on math with Qwen3-4B](/tutorials/rl/005_dapo/)\n- [Audio GRPO on Qwen3-ASR-1.7B — transcribe LibriSpeech, reward −WER](/tutorials/rl/006_audio_asr/)\n- [Sweep hyperparameters across runs with TrainingGroup](/tutorials/rl/007_param_sweep/)\n- [GUI grounding with Qwen3-VL-8B — predict click coordinates from screenshots](/tutorials/rl/008_computer_use/)\n- [Cross-tokenizer agentic distillation on BFCL v3 multi-turn with live, execution-grounded rewards — DeepSeek V4 Flash teacher, Qwen3.6-35B-A3B student](/tutorials/rl/009_cross_tokenizer_distillation/)\n\n**Source:** [`modal_training_gym/common/train.py`](https://github.com/modal-projects/training-gym/blob/main/modal_training_gym/common/train.py)\n"
TrainConfig
Compose dataset, model, and recipe into one training entrypoint.
from modal_training_gym.common.train import TrainConfigCompose dataset, model, and recipe into one training entrypoint.
Fields
Section titled “Fields”| Field | Type | Default | Description |
|---|---|---|---|
dataset | DatasetConfig | The training dataset. train() materializes it into the framework’s /data volume before training if it isn’t already present. | |
model | ModelConfig | The model to train. Carries model identity (model_name) and weight-download logic; weights are downloaded into the shared HuggingFace cache volume on first use and reused across runs. | |
recipe | modal_training_gym.train_recipes.base.BaseTrainRecipe | Framework recipe (SlimeRecipe or MilesConfig). Selects the training framework and carries Modal infra settings (GPU type, node count, image) plus framework CLI flags. | |
checkpoint | modal_training_gym.common.checkpoint.Checkpoint | None | None | Checkpoint to resume training from. When None, training starts from the base model weights. Default None. |
merge_model_recipe | bool | True | When True, merges the known-model preset recipe (e.g. Qwen3_4b_Recipe) onto recipe fields you left unset. Set False to run the recipe exactly as written, with no preset defaults. Default True. |
detach | bool | True | Run the training app detached so it keeps running on Modal even if the local client disconnects (terminal closed, laptop asleep). Set False for an attached run that stops on Ctrl-C. Default True. |
group_id | str | None | None | Shared sweep id. Set by TrainingGroup so every run in a sweep carries the same id, letting the dashboard group variants together. Not usually set by hand. Default None. |
group_overrides | dict[str, Any] | None | None | Per-variant parameter overrides applied by TrainingGroup, keyed by dotted field path (e.g. {"recipe.lr": 1e-5}). Recorded in run metadata so the dashboard can label each variant. Default None. |
group_axes | list[str] | None | None | Names of the swept parameter paths in a TrainingGroup grid. Recorded in run metadata for dashboard grouping; falls back to the keys of group_overrides when unset. Default None. |
Methods
Section titled “Methods”context_plan_line(self) -> str | None
Section titled “context_plan_line(self) -> str | None”One-line summary of the effective training context length and parallelism plan.
launch(self, *, show_output: bool = True, prepare_inputs: bool = False) -> modal_training_gym.common.run.TrainingRun
Section titled “launch(self, *, show_output: bool = True, prepare_inputs: bool = False) -> modal_training_gym.common.run.TrainingRun”Start training in a detached Modal app and return immediately.
train(self, *, show_output: bool = True) -> modal_training_gym.common.train_result.TrainResult
Section titled “train(self, *, show_output: bool = True) -> modal_training_gym.common.train_result.TrainResult”Build the app, run training, and return the TrainResult.
Related Tutorials
Section titled “Related Tutorials”- Qwen3-4B haiku evaluation with verifiable rewards — serve, evaluate, train, compare
- Code RL with Harbor hello-world and sandboxed verification
- Multi-turn number-guessing RL with custom generate and reward functions
- On-policy distillation on math — Qwen3-8B teacher, Qwen3-4B student
- DAPO on math with Qwen3-4B
- Audio GRPO on Qwen3-ASR-1.7B — transcribe LibriSpeech, reward −WER
- Sweep hyperparameters across runs with TrainingGroup
- GUI grounding with Qwen3-VL-8B — predict click coordinates from screenshots
- Cross-tokenizer agentic distillation on BFCL v3 multi-turn with live, execution-grounded rewards — DeepSeek V4 Flash teacher, Qwen3.6-35B-A3B student