o
    0‚›iy  ã                   @   sB   d dl mZ eƒ rddlmZ ddlmZ ddœdefd	d
„ZdS )é   )Úis_tqdm_availableé    )Útqdmé   )ÚPartialStateT)Úmain_process_onlyr   c                 O   sf   t ƒ stdƒ‚t|ƒdkrt|d tƒrtdƒ‚| dd¡}| r(|s(tƒ jdk}t	|i |¤d|i¤ŽS )zÛ
    Wrapper around `tqdm.tqdm` that optionally displays only on the main process.

    Args:
        main_process_only (`bool`, *optional*):
            Whether to display the progress bar only on the main process
    zZAccelerate's `tqdm` module requires `tqdm` to be installed. Please run `pip install tqdm`.r   z›Passing `True` or `False` as the first argument to Accelerate's `tqdm` wrapper is unsupported. Please use the `main_process_only` keyword argument instead.ÚdisableF)
r   ÚImportErrorÚlenÚ
isinstanceÚboolÚ
ValueErrorÚpopr   Úlocal_process_indexÚ_tqdm)r   ÚargsÚkwargsr   © r   úW/sda-disk/www/egybert/egybert_env/lib/python3.10/site-packages/accelerate/utils/tqdm.pyr      s   ÿr   N)Úimportsr   Ú	tqdm.autor   r   Ústater   r   r   r   r   r   Ú<module>   s
   