RunnerConfig¶
danling.runners.RunnerConfig
¶
Bases: Config
Configuration class for managing and persisting all states of a DanLing Runner.
The RunnerConfig class provides a hierarchical configuration system that handles:
- Parameter management: Hyperparameters, model settings, training options
- Experiment tracking: IDs, names, and other metadata for runs and experiments
- Serialization: Save/load configurations from files or command line
- Reproducibility: Tracking seeds and settings for reproducible runs
RunnerConfig inherits from Config and provides attribute-style access to nested values:
| Python | |
|---|---|
RunnerConfig objects support three types of hierarchical attribute access patterns:
-
Direct assignment for simple values:
Python -
Auto-created nested objects for hierarchical settings:
-
Class-level annotations for typed properties with defaults:
Command-line integration is built-in. You can define a configuration and then override values via command line arguments:
General:
| Name | Type | Description |
|---|---|---|
stack |
str
|
Runner stack selector used by |
Reproducibility:
| Name | Type | Description |
|---|---|---|
seed |
int
|
Random seed for reproducibility. If not set, a random value is generated. |
deterministic |
bool
|
Whether to enforce deterministic operations in PyTorch.
Defaults to |
Progress:
| Name | Type | Description |
|---|---|---|
steps |
int | None
|
Final global step target for training.
In step mode, training stops when |
epochs |
int | None
|
Final epoch index boundary for training.
In epoch mode, training iterates epochs until |
Model Evaluation:
| Name | Type | Description |
|---|---|---|
score_split |
str
|
Dataset split to use for model selection. Defaults to None.
If unset, runner infers once ( |
score_name |
str
|
Metric name to use for model selection. Defaults to “loss”. |
scheduler.interval |
str
|
Scheduler advancement policy.
Supported values: |
scheduler.monitor |
str
|
Optional metric selector for metric schedulers.
Supports dotted paths such as |
Optimization:
| Name | Type | Description |
|---|---|---|
optim.param_groups |
list[dict] | None
|
Optional regex-based optimizer
parameter groups. Each entry requires |
I/O:
| Name | Type | Description |
|---|---|---|
workspace_root |
str
|
Root directory for experiments. Defaults to |
auto_resume |
bool
|
Auto-resume from backend latest checkpoint alias/path.
When |
resume |
str | None
|
Optional full-state checkpoint source for resume workflows.
This is a path-like identifier consumed by runner |
pretrained |
str | None
|
Optional model-only checkpoint source for finetune workflows.
This is a path-like identifier consumed by runner |
lineage |
str
|
Top-level lineage namespace.
Defaults to |
experiment |
str
|
Experiment namespace. Defaults to |
checkpoint.dir_name |
str
|
Subdirectory name for checkpoints. Defaults to |
checkpoint.async_enabled |
bool
|
Whether to persist checkpoints asynchronously.
Defaults to |
checkpoint.async_mode |
str | None
|
Checkpoint async behavior.
Supported values: |
checkpoint.dedicated_async_process_group |
bool
|
Use a dedicated process group for async DCP
checkpoint I/O to reduce interference with training collectives. Defaults to |
checkpoint.async_process_group_backend |
str
|
Backend for the dedicated async checkpoint process
group. Defaults to |
checkpoint.backend |
str
|
Checkpoint backend selected at runtime by the runner
( |
checkpoint.wait_timeout |
float
|
Timeout in seconds when draining async checkpoint writes
during runner shutdown ( |
parallel.axes.replicate |
int
|
Data-replication degree for DDP/HSDP-style replication.
Defaults to |
parallel.axes.shard |
int
|
Data-sharding degree for FSDP-style sharding.
Defaults to |
parallel.axes.context |
int
|
Context/sequence parallel degree. Defaults to |
parallel.axes.pipeline |
int
|
Pipeline-parallel degree. Defaults to |
parallel.axes.tensor |
int
|
Tensor-parallel degree. Defaults to |
parallel.axes.expert |
int
|
Expert-parallel degree for MoE models. Defaults to |
parallel.axes.expert_tensor |
int
|
Expert tensor-parallel degree for MoE models. Defaults to |
parallel.pipeline_schedule |
str
|
Pipeline schedule class name resolved by
|
parallel.pipeline_microbatch_size |
int
|
Local microbatch size used to infer
schedule microbatch count as |
parallel.pipeline_n_microbatches |
int
|
Explicit schedule microbatch count.
When set, overrides |
parallel.module_fqns_per_model_part |
list[list[str]] | None
|
Optional
module FQNs for simple pipeline stage extraction. The outer list
length is the total pipeline stage count and must be divisible by
|
log |
bool
|
Whether to enable file logging. Defaults to |
tensorboard |
bool
|
Whether to use TensorBoard for visualization. Defaults to |
wandb.enabled |
bool
|
Whether to enable Weights & Biases scalar logging. Defaults to |
wandb.project |
str | None
|
Optional W&B project name. Defaults to |
wandb.entity |
str | None
|
Optional W&B entity/team override. |
wandb.group |
str | None
|
Optional W&B group name. Defaults to |
wandb.name |
str | None
|
Optional W&B display name. Defaults to stable runner |
wandb.job_type |
str | None
|
Optional W&B job type. |
wandb.tags |
list[str] | str | None
|
Optional W&B run tags. |
wandb.dir |
str | None
|
Optional local W&B run directory. Defaults to run dir. |
wandb.mode |
str | None
|
Optional W&B mode such as |
ft.enabled |
bool
|
Enable TorchFT-managed fault tolerance. Defaults to |
ft.process_group |
str
|
TorchFT coordination backend. Supported values: |
ft.process_group_timeout_ms |
int
|
TorchFT process-group timeout in milliseconds.
Defaults to |
ft.replica_id |
int
|
Replica-group identifier for this run. Defaults to |
ft.group_size |
int
|
Number of replica groups participating in TorchFT. Defaults to |
ft.min_replica_size |
int
|
Minimum healthy replicas required by TorchFT per step.
Defaults to |
log_interval |
int
|
Iterations between log outputs. If None, auto-calculated. |
checkpoint.interval |
int
|
Interval between checkpoint save attempts for |
checkpoint.keep_latest_k |
int
|
Number of framework-generated history checkpoints to retain.
|
checkpoint.load_only |
bool
|
Disable checkpoint persistence entirely while still allowing checkpoint loading. |
checkpoint.enable_ft_dataloader_checkpoints |
bool
|
Enable per-replica dataloader checkpoints for FT recovery.
Uses DCP and stores checkpoints under
|
checkpoint.ft_replica_id |
str | None
|
Replica identifier used for FT dataloader checkpoint directory naming.
Defaults to |
checkpoint.ft_dataloader_checkpoint_prefix |
str
|
Prefix used for FT per-replica checkpoint directories.
Defaults to |
checkpoint.exclude_from_loading |
list[str] | str | None
|
Checkpoint keys to skip during
|
checkpoint.last_save_model_only |
bool
|
Save model-only payload on final |
checkpoint.export_dtype |
str
|
Optional dtype cast for final model-only export
( |
dataloader.batch_size |
int | None
|
Local dataloader batch size passed to
|
dataloader.shuffle |
bool | None
|
Optional shuffle override. When unset, train splits shuffle and non-train splits do not. |
dataloader.drop_last |
bool | None
|
Optional drop-last override. When unset, train splits drop incomplete batches and non-train splits keep them. |
dataloader.num_workers |
/ persistent_workers / prefetch_factor / pin_memory
|
Standard PyTorch DataLoader kwargs forwarded to |
dataloader.in_order |
bool
|
PyTorch DataLoader ordering flag. |
dataloader.snapshot_every_n_steps |
int | None
|
StatefulDataLoader snapshot cadence. |
dataloader.<split> |
dict
|
Split-specific overrides merged on top of default
dataloader kwargs, for example |
fsdp.enabled |
bool
|
Enable FSDP2 wrapping in |
fsdp.reshard_after_forward |
bool | int | None
|
Optional FSDP2 reshard policy. |
fsdp.mp_policy |
bool | int | None
|
Optional FSDP2 mixed precision policy. |
fsdp.offload_policy |
bool | int | None
|
Optional FSDP2 CPU offload policy. |
compile.enable |
bool
|
Whether to enable |
compile.backend |
str
|
Optional backend passed to |
compile.fullgraph |
bool
|
Optional |
compile.dynamic |
bool
|
Optional |
compile.mode |
str
|
Optional mode passed to |
compile.options |
dict
|
Optional options passed to |
compile.optimize_ddp |
str | None
|
Optional |
compile.precompile_artifact_dir |
str | None
|
Optional directory for GraphRunner torch compiler cache artifacts. Current eager runners ignore this setting. |
compile.memory_policy |
str | None
|
Optional graph-memory policy label for experimental graph paths.
GraphRunner currently accepts |
comm.init_timeout_seconds |
int | None
|
Optional distributed process-group timeout used during initialization and early startup. |
comm.train_timeout_seconds |
int | None
|
Optional tighter distributed process-group timeout applied once after the first successful optimizer step. |
gc.interval |
int | None
|
Optional periodic Python GC cadence. When unset, runner-managed GC pacing is disabled. |
gc.generation |
int
|
Python GC generation passed to |
gc.disable_automatic |
bool
|
Disable CPython automatic GC while runner-managed pacing is enabled.
Defaults to |
profiling.enabled |
bool
|
Enable bounded-step |
profiling.wait |
int
|
Profiler schedule wait steps before warmup. Defaults to |
profiling.warmup |
int
|
Profiler schedule warmup steps. Defaults to |
profiling.active |
int
|
Profiler schedule active trace steps. Defaults to |
profiling.repeat |
int | None
|
Optional profiler schedule repeat count. |
profiling.record_shapes |
bool
|
Enable shape recording in traces. Defaults to |
profiling.profile_memory |
bool
|
Enable profiler-side memory recording. Defaults to |
profiling.with_stack |
bool
|
Include Python stack traces in profiler output. Defaults to |
profiling.with_flops |
bool
|
Enable profiler FLOPs estimation when available. Defaults to |
profiling.trace_dir |
str
|
Relative or absolute trace output directory. Defaults to |
heartbeat.enabled |
bool
|
Enable a machine-readable per-rank heartbeat/progress file. Defaults to |
heartbeat.interval_seconds |
float
|
Heartbeat write interval in seconds. Defaults to |
heartbeat.dir_name |
str
|
Subdirectory under the run dir for heartbeat files. Defaults to |
| Text Only | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
Note
Always store all parameters needed to reproduce a run in the RunnerConfig. The RunnerConfig is automatically saved with checkpoints, enabling exact resumption.
See Also
Runner: Main runner class that uses this config.chanfig.Config: Base config implementation.
Source code in danling/runners/config.py
| Python | |
|---|---|
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | |