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 |
accum_steps |
int
|
Number of micro-batches per optimizer step.
Defaults to |
Model Evaluation:
| Name | Type | Description |
|---|---|---|
score.split |
str
|
Dataset split to use for model selection. Defaults to None.
If unset, runner infers once ( |
score.metric |
str
|
Metric key to use for model selection. Defaults to “loss”. |
score.patience |
int | float
|
Early-stop patience in epoch mode. Defaults to infinity. |
sched.interval |
str
|
Scheduler advancement policy.
Supported values: |
sched.monitor |
str
|
Optional metric selector for metric schedulers.
Supports dotted paths such as |
Optimization:
| Name | Type | Description |
|---|---|---|
optim.type |
str | None
|
Optimizer registry key, for example |
optim.lr |
/ weight_decay / betas / eps / momentum
|
Common optimizer kwargs forwarded to the optimizer registry when present. |
optim.param_groups |
list[dict] | None
|
Optional regex-based optimizer
parameter groups. Each entry requires |
sched.type |
str | None
|
Scheduler registry key, for example |
sched.total_steps |
/ warmup_steps / cooldown_steps / final_lr_ratio / final_lr
|
Common DanLing |
sched.step_size |
/ milestones / gamma / T_max / eta_min / patience / factor
|
Common PyTorch scheduler kwargs forwarded when present. |
I/O:
| Name | Type | Description |
|---|---|---|
workspace.root |
str
|
Root directory for experiments. Defaults to |
checkpoint |
str | None
|
Optional full-state checkpoint source for resume workflows.
This is a path-like identifier consumed by runner |
resume |
bool
|
Auto-resume from the backend-native latest checkpoint source when |
pretrained |
str | None
|
Optional model-only checkpoint source for finetune workflows.
This is a path-like identifier consumed by runner |
workspace.lineage |
str
|
Top-level lineage namespace.
Defaults to |
workspace.experiment |
str
|
Experiment namespace. Defaults to |
ckpt.dir |
str
|
Checkpoint directory. Relative paths are resolved under |
ckpt.async_mode |
str
|
Checkpoint async behavior. Defaults to |
ckpt.dedicated_async_process_group |
bool
|
Use a dedicated process group for async DCP
checkpoint I/O to reduce interference with training collectives. Defaults to |
ckpt.async_process_group_backend |
str
|
Backend for the dedicated async checkpoint process
group. Defaults to |
ckpt.backend |
str
|
Checkpoint backend selected at runtime by the runner
( |
ckpt.wait_timeout_seconds |
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_microbatches |
int
|
Explicit schedule microbatch count.
When set, overrides |
parallel.pipeline_partitions |
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
|
logging.enabled |
bool
|
Whether to enable file logging. Defaults to |
logging.interval |
int
|
Iterations between log outputs. If None, auto-calculated. |
logging.file |
str | None
|
Optional log file path.
Defaults to |
tensorboard.enabled |
bool
|
Whether to use TensorBoard for visualization. Defaults to |
tensorboard.log_dir |
str | None
|
Optional TensorBoard log directory.
Defaults to |
tensorboard.comment |
/ purge_step / max_queue / flush_secs / filename_suffix
|
Optional |
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.id |
str | None
|
Optional stable W&B run id. |
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.notes |
str | None
|
Optional W&B run notes. |
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 directory. |
wandb.mode |
str | None
|
Optional W&B mode such as |
wandb.resume |
/ save_code / sync_tensorboard
|
Optional common W&B init kwargs. |
ft.enabled |
bool
|
Enable TorchFT-managed fault tolerance. Defaults to |
ft.process_group |
str
|
TorchFT coordination backend. Supported values: |
ft.process_group_timeout_seconds |
float
|
TorchFT process-group timeout in seconds.
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 |
ckpt.interval |
int
|
Interval between checkpoint save attempts for |
ckpt.keep_latest_k |
int
|
Number of framework-generated history checkpoints to retain.
|
ckpt.enabled |
bool
|
Whether to persist checkpoints. Set |
ckpt.dataloader_checkpoint.enabled |
bool
|
Enable per-replica dataloader checkpoints.
Uses DCP and stores checkpoints under
|
ckpt.dataloader_checkpoint.replica_id |
str | None
|
Replica identifier used for dataloader checkpoint directory.
Defaults to |
ckpt.dataloader_checkpoint.prefix |
str
|
Prefix used for per-replica dataloader checkpoint directories.
Defaults to |
ckpt.export_dtype |
str
|
Optional dtype cast for model-only checkpoint 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.sampler |
/ batch_sampler / collate_fn
|
Optional DataLoader
construction hooks forwarded to |
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.shard_placement_fn |
bool | int | None
|
Optional FSDP2 shard placement callable. |
fsdp.mixed_precision_policy |
bool | int | None
|
Optional FSDP2 mixed precision policy. |
fsdp.offload_policy |
bool | int | None
|
Optional FSDP2 CPU offload policy. |
fsdp.ignored_params |
bool | int | None
|
Optional parameters excluded from FSDP2 wrapping. |
compile.enabled |
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 |
dist.init_timeout_seconds |
int | None
|
Optional distributed process-group timeout used during initialization and early startup. |
dist.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.activities |
str | list[str] | None
|
Explicit profiler activities such as
|
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.with_modules |
/ acc_events / use_cuda
|
Optional profiler kwargs. |
profiling.post_processing_timeout_seconds |
float | None
|
Optional profiler post-processing timeout in seconds. |
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 |
str
|
Heartbeat directory. Relative paths are resolved under |
| 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 | |
|---|---|
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 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 | |