Configuration
About
The d9d.loop.config package defines the job configuration as Pydantic models. TrainerConfig configures a training job, and InferenceConfig configures an inference job. Pydantic validates the whole configuration when you load it.
Usage
Load the configuration from JSON and pass it to the configurator as parameters:
Periodic actions, such as checkpointing.period_steps, take a StepActionPeriod. It is a step interval (e.g. 100), "last_step" or "disable".
You can leave out the fields and sections that have defaults. An unknown key fails the validation, so a misspelled key stops the job before it starts. The trainer section of the Quickstart config holds only the required fields.
API Reference
Main Config
d9d.loop.config.TrainerConfig
Bases: BaseModel
Configuration for a complete training job.
Attributes:
| Name | Type | Description |
|---|---|---|
run |
RunConfig
|
Meta-information about the run (name, ID, tags). |
schedule |
JobScheduleConfig
|
Job duration settings. |
data_prefetch |
DataPrefetchConfig
|
Settings for copying data to the device ahead of time. |
logging |
JobLoggerConfig
|
Experiment tracking settings. |
pipelining |
PipeliningConfig
|
Pipeline parallelism schedule and settings. |
model_stage_factory |
ModelStageFactoryConfig
|
Model initialization and additional checkpointing logic. |
determinism |
DeterminismConfig
|
Random seed settings. |
gc |
GarbageCollectionConfig
|
Garbage collection settings. |
checkpointing |
CheckpointingConfig
|
Checkpoint saving settings. |
gradient_clipping |
GradientClippingConfig
|
Gradient clipping settings. |
profiling |
ProfilingConfig | None
|
Profiler settings. If |
gradient_manager |
GradientManagerConfig
|
Gradient synchronization settings. |
timeout |
TimeoutConfig
|
Distributed timeout settings. |
d9d.loop.config.InferenceConfig
Bases: BaseModel
Configuration for a complete inference or evaluation job.
Attributes:
| Name | Type | Description |
|---|---|---|
schedule |
JobScheduleConfig
|
Job duration settings. |
data_prefetch |
DataPrefetchConfig
|
Settings for copying data to the device ahead of time. |
model_stage_factory |
ModelStageFactoryConfig
|
Model initialization logic. |
determinism |
DeterminismConfig
|
Random seed settings. |
gc |
GarbageCollectionConfig
|
Garbage collection settings. |
checkpointing |
CheckpointingConfig
|
Checkpointing settings. |
profiling |
ProfilingConfig | None
|
Profiler settings. If |
timeout |
TimeoutConfig
|
Distributed timeout settings. |
Diagnostics and Reproducibility
d9d.tracker.RunConfig
d9d.loop.config.JobLoggerConfig
Bases: BaseModel
Configuration for experiment tracking and logging.
Attributes:
| Name | Type | Description |
|---|---|---|
period_steps |
StepActionPeriod
|
How often the metrics are logged. The metrics are accumulated over the steps between two logging steps. The loss and the total gradient norm are logged every step. |
tracker |
AnyTrackerConfig
|
The experiment tracker backend configuration, e.g. Aim. |
max_pending_steps |
int
|
How many steps the logged values can lag behind the current step, waiting for the GPU to compute them. When they lag more, logging waits for the GPU, which also limits how far the host runs ahead of the GPU. |
d9d.loop.config.ProfilingConfig
Bases: BaseModel
Configuration for the PyTorch Profiler.
Attributes:
| Name | Type | Description |
|---|---|---|
traces_dir |
Path
|
The directory for trace files. |
period_steps |
int
|
The total length of a profiling cycle (wait + warmup + active), in steps. |
warmup_steps |
int
|
The number of profiler warmup steps before recording. |
active_steps |
int
|
The number of steps to record. |
record_shapes |
bool
|
Whether to record the input shapes of operators. |
with_stack |
bool
|
Whether to record the Python call stacks of operators. They make up most of a trace. |
d9d.loop.config.DeterminismConfig
Experiment Trackers
d9d.tracker.AnyTrackerConfig = Annotated[AimConfig | LogTrackerConfig | MLflowConfig | NullTrackerConfig | TensorBoardConfig | WandbConfig, Field(discriminator='provider')]
module-attribute
Union of all tracker configurations, discriminated by the provider field.
d9d.tracker.provider.log.LogTrackerConfig
d9d.tracker.provider.null.NullTrackerConfig
d9d.tracker.provider.wandb.config.WandbConfig
Bases: BaseModel
Configuration for the W&B tracker backend.
Attributes:
| Name | Type | Description |
|---|---|---|
provider |
Literal['wandb']
|
Discriminator field. Always |
project |
str
|
The W&B project. |
entity |
str | None
|
The team or user that owns the project. |
group |
str | None
|
The group of the run, e.g. to show the runs of one experiment together. |
tags |
list[str]
|
The tags of the run. |
mode |
Literal['online', 'offline']
|
|
dir |
str | None
|
The directory for the local files of W&B. |
capture_terminal_logs |
bool
|
Whether to capture stdout and stderr. |
d9d.tracker.provider.tensorboard.config.TensorBoardConfig
d9d.tracker.provider.mlflow.config.MLflowConfig
Bases: BaseModel
Configuration for the MLflow tracker backend.
Attributes:
| Name | Type | Description |
|---|---|---|
provider |
Literal['mlflow']
|
Discriminator field. Always |
experiment |
str
|
The name of the MLflow experiment. The tracker creates it if it does not exist. |
tracking_uri |
str | None
|
The URI of the tracking server or store, e.g. |
d9d.tracker.provider.aim.config.AimConfig
Bases: BaseModel
Configuration for the Aim tracker backend.
Attributes:
| Name | Type | Description |
|---|---|---|
provider |
Literal['aim']
|
Discriminator field. Always |
repo |
str
|
The path or URL of the Aim repository. |
log_system_params |
bool
|
Whether to log system resource usage (CPU, GPU, memory). |
capture_terminal_logs |
bool
|
Whether to capture stdout and stderr. |
system_tracking_interval |
int
|
The interval of system monitoring in seconds. |
Scheduling
d9d.loop.config.JobScheduleConfig
Data Prefetching
d9d.loop.config.DataPrefetchConfig
Bases: BaseModel
Configuration for copying microbatch packs to the device ahead of the steps that consume them.
Attributes:
| Name | Type | Description |
|---|---|---|
prefetch_factor |
int
|
The number of packs copied to the device ahead of the current step. The copies run on
a separate CUDA stream and overlap with compute. Each prefetched pack occupies device memory.
|
Checkpointing
d9d.loop.config.CheckpointingConfig
Bases: BaseModel
Configuration for saving model snapshots.
Attributes:
| Name | Type | Description |
|---|---|---|
save_dir |
Path
|
The root directory for checkpoints. |
period_steps |
StepActionPeriod
|
How often to save a checkpoint. |
num_to_keep |
int | None
|
The maximum number of recent checkpoints to keep. If |
Model Initialization
d9d.loop.config.ModelStageFactoryConfig
Bases: BaseModel
Configuration for initializing model weights.
Attributes:
| Name | Type | Description |
|---|---|---|
source_checkpoint |
Path | None
|
The path to a checkpoint to load into the model before the job starts. If |
checkpoint_only_trainable_parameters |
bool
|
If |
Optimization
d9d.loop.config.GradientClippingConfig
d9d.loop.config.GradientManagerConfig
Infrastructure
d9d.loop.config.PipeliningConfig
Bases: BaseModel
Configuration for pipeline parallelism orchestration.
Attributes:
| Name | Type | Description |
|---|---|---|
schedule |
AnyPipelineScheduleConfig
|
The pipeline schedule configuration. |
d9d.loop.config.GarbageCollectionConfig
Bases: BaseModel
Configuration for manual Python garbage collection control.
Attributes:
| Name | Type | Description |
|---|---|---|
period_steps |
StepActionPeriod
|
How often to run the Python garbage collector. |
d9d.loop.config.TimeoutConfig
Types
d9d.loop.config.StepActionPeriod = int | StepActionSpecial
module-attribute
Period of a periodic action.
An int is the period in steps. A StepActionSpecial runs the action only at the last step or disables it.
d9d.loop.config.StepActionSpecial
Bases: StrEnum
Special flag values for configuring periodic actions.
Attributes:
| Name | Type | Description |
|---|---|---|
last_step |
The action runs once, at the last step of the run. |
|
disable |
The action never runs. |