nemo_automodel.training.rng
#
Module Contents#
Classes#
Context manager for reproducible RNG states across random, NumPy, and PyTorch. |
Functions#
Initialize RNGs for Python, NumPy, and PyTorch (incl. CUDA) with a seed. |
API#
- nemo_automodel.training.rng.init_all_rng(seed: int, ranked: bool = False)[source]#
Initialize RNGs for Python, NumPy, and PyTorch (incl. CUDA) with a seed.
- Parameters:
seed (int) – Base seed value.
ranked (bool) – Adjust seed by process rank if True.
- class nemo_automodel.training.rng.StatefulRNG(seed: int, ranked: bool = False)[source]#
Context manager for reproducible RNG states across random, NumPy, and PyTorch.
Initialization
Initialize and optionally rank-adjust RNGs with a given seed.
- Parameters:
seed (int) – Base seed for RNGs.
ranked (bool) – Adjust seed based on process rank.
- state_dict()[source]#
Get current RNG states.
- Returns:
RNG states for random, NumPy, and PyTorch.
- Return type:
dict