o
    ép©ic  ã                   @   sd   d dl Z d dlZG dd„ deƒZG dd„ deƒZdejfdd„Zdejfd	d
„Zdejfdd„Z	dS )é    Nc                   @   ó   e Zd ZdS )ÚReproducibilityErrorN©Ú__name__Ú
__module__Ú__qualname__© r   r   úX/home/ubuntu/.local/lib/python3.10/site-packages/pyannote/audio/utils/reproducibility.pyr      ó    r   c                   @   r   )ÚReproducibilityWarningNr   r   r   r   r	   r   "   r
   r   Údevicec                 C   s0   | j dkrtjjjjstjjjrtdƒ‚d S d S ©NÚcudaa8  Please disable TensorFloat-32 (TF32) by calling
   >>> import torch
   >>> torch.backends.cuda.matmul.allow_tf32 = False
   >>> torch.backends.cudnn.allow_tf32 = False
or you might face reproducibility issues and obtain lower accuracy.
See https://github.com/pyannote/pyannote-audio/issues/1370 for more details.)ÚtypeÚtorchÚbackendsr   ÚmatmulÚ
allow_tf32Úcudnnr   ©r   r   r   r	   Úraise_reproducibility&   s   

ÿÿÿýr   c                 C   s:   | j dkrtjjjjstjjjrt t	dƒ¡ d S d S d S r   ©
r   r   r   r   r   r   r   ÚwarningsÚwarnr   r   r   r   r	   Úwarn_reproducibility4   s   

ÿÿÿÿýr   c                 C   sP   | j dkr$tjjjjstjjjr&dtjjj_dtjj_t t	dƒ¡ d S d S d S )Nr   FaJ  TensorFloat-32 (TF32) has been disabled as it might lead to reproducibility issues and lower accuracy.
It can be re-enabled by calling
   >>> import torch
   >>> torch.backends.cuda.matmul.allow_tf32 = True
   >>> torch.backends.cudnn.allow_tf32 = True
See https://github.com/pyannote/pyannote-audio/issues/1370 for more details.
r   r   r   r   r	   Úfix_reproducibilityD   s   

ÿÿ
ÿÿûr   )
r   r   Ú	Exceptionr   ÚUserWarningr   r   r   r   r   r   r   r   r	   Ú<module>   s   