§
    ­¸j´  ã                  óD   — d Z ddlmZ ddlZddlZddlZddlmZ ddd
„Z	dS )z4Reproducibility helpers: seed all RNGs consistently.é    )ÚannotationsN)Ú
get_loggeré   ÚseedÚintÚreturnÚNonec                ó�  — t           j                             ¦   «         rt           j                             ¦   «         nd}t	          j        | |z   ¦  «         t          j                             | |z   ¦  «         t          j        | ¦  «         t           j         	                    ¦   «         rKt           j         
                    | ¦  «         dt           j        j        _        dt           j        j        _        	 t          j        dd¬¦  «         dS # t           $ r-}t#          ¦   «                              d|¦  «         Y d}~dS d}~ww xY w)a�  Seed all random number generators for reproducibility.

    Sets seeds for Python's ``random`` module, NumPy, and PyTorch (CPU and all CUDA devices).  Also configures cuDNN to
    use deterministic algorithms and disables its auto-tuner, then escalates to
    :func:`torch.use_deterministic_algorithms` with ``warn_only=True`` so every op that offers a deterministic
    implementation uses it, and the ones that do not (e.g. some scatter / ``grid_sample`` CUDA kernels) emit a warning
    at execution time instead of raising.  Results are reproducible across runs at the cost of a possible slight
    performance decrease.

    Under distributed data-parallel, ``random`` and NumPy are offset by the process rank so stochastic augmentations
    differ across ranks, while PyTorch is seeded identically so model initialization stays in sync.

    Args:
        seed: Integer seed value.  Defaults to ``7``.
    r   TF)Ú	warn_onlyz-Could not enable deterministic algorithms: %sN)ÚtorchÚdistributedÚis_initializedÚget_rankÚrandomr   ÚnpÚmanual_seedÚcudaÚis_availableÚmanual_seed_allÚbackendsÚcudnnÚdeterministicÚ	benchmarkÚuse_deterministic_algorithmsÚRuntimeErrorr   Úwarning)r   ÚrankÚerrors      úp/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/rfdetr/utilities/reproducibility.pyÚseed_allr       s'  € õ  ,1Ô+<×+KÒ+KÑ+MÔ+MÐT�5Ô×%Ò%Ñ'Ô'Ð'ÐST€DÝ
„K��t‘ÑÔÐÝ„I‡N‚N�4˜$‘;ÑÔÐÝ	Ô�dÑÔÐÝ„z×ÒÑ Ô ð /ÝŒ
×"Ò" 4Ñ(Ô(Ð(Ø-1�ŒÔÔ*Ø).�ŒÔÔ&ðUÝÔ*¨4¸4Ð@Ñ@Ô@Ð@Ð@Ð@øÝð Uð Uð UÝ‰Œ×ÒÐLÈeÑTÔTÐTÐTÐTÐTÐTÐTÐTøøøøðUøøøs   Ã6D Ä
EÄ"E Å E)r   )r   r   r   r	   )
Ú__doc__Ú
__future__r   r   Únumpyr   r   Úrfdetr.utilities.loggerr   r    © ó    r   ú<module>r'      sy   ðð ;Ð :à "Ð "Ð "Ð "Ð "Ð "à €€€à Ð Ð Ð Ø €€€à .Ð .Ð .Ð .Ð .Ð .ðUð Uð Uð Uð Uð Uð Ur&   