unilab.training.seed

Shared training seed contract helpers.

Functions

apply_configured_training_seed(cfg, *[, ...])

Resolve and apply the configured training seed before runtime construction.

apply_training_seed(seed, *[, ...])

Apply a seed to the runtimes used by training entrypoints.

derive_worker_seed(base_seed[, worker_index])

Derive deterministic subprocess seeds from the effective run seed.

resolve_training_seed(cfg)

Resolve the configured seed, preferring the algorithm-level contract.

Classes

TrainingSeedInfo

Configured and effective seed metadata for a training run.

class unilab.training.seed.TrainingSeedInfo[source]

Bases: object

Configured and effective seed metadata for a training run.

Parameters:
configured_seed: int | None
configured_seed_source: str | None
effective_seed: int | None
to_dict()[source]
Return type:

dict[str, int | str | None]

__init__(configured_seed, configured_seed_source, effective_seed)
Parameters:
unilab.training.seed.resolve_training_seed(cfg)[source]

Resolve the configured seed, preferring the algorithm-level contract.

Parameters:

cfg (Any)

Return type:

TrainingSeedInfo

unilab.training.seed.derive_worker_seed(base_seed, worker_index=0)[source]

Derive deterministic subprocess seeds from the effective run seed.

Parameters:
Return type:

int | None

unilab.training.seed.apply_training_seed(seed, *, torch_runtime=True, cuda=True, mlx_runtime=False)[source]

Apply a seed to the runtimes used by training entrypoints.

Parameters:
Return type:

int | None

unilab.training.seed.apply_configured_training_seed(cfg, *, torch_runtime=True, cuda=True, mlx_runtime=False)[source]

Resolve and apply the configured training seed before runtime construction.

Parameters:
Return type:

TrainingSeedInfo