Ë
    ÿÍ:jñ  ã                   óR   — d Z ddlmZ ddlmZ ddlmZmZ ed
deded   fd„«       Z	y	)z1Utilities to help with reproducibility of models.é    )Ú	Generator)Úcontextmanager©Ú_collect_rng_statesÚ_set_rng_statesÚinclude_cudaÚreturn)NNNc              #   ó@   K  — t        | «      }d–— t        |«       y­w)a  A context manager that resets the global random state on exit to what it was before entering.

    It supports isolating the states for PyTorch, Numpy, and Python built-in random number generators.

    Args:
        include_cuda: Whether to allow this function to also control the `torch.cuda` random number generator.
            Set this to ``False`` when using the function in a forked process where CUDA re-initialization is
            prohibited.

    Example:
        >>> import torch
        >>> torch.manual_seed(1)  # doctest: +ELLIPSIS
        <torch._C.Generator object at ...>
        >>> with isolate_rng():
        ...     [torch.rand(1) for _ in range(3)]
        [tensor([0.7576]), tensor([0.2793]), tensor([0.4031])]
        >>> torch.rand(1)
        tensor([0.7576])

    Nr   )r   Ústatess     úu/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/lightning/pytorch/utilities/seed.pyÚisolate_rngr      s   è ø€ ô, ! Ó.€FÛ	Ü�FÕùs   ‚N)T)
Ú__doc__Úcollections.abcr   Ú
contextlibr   Úlightning.fabric.utilities.seedr   r   Úboolr   © ó    r   ú<module>r      s;   ðñ 8å %Ý %ç Pð ñ˜dð ¨iÐ8HÑ.Iò ó ñr   