
    biy                     H    d dl mZ  e       rddlmZ ddlmZ dddefd	Zy
)   )is_tqdm_available    )tqdm   )PartialStateT)main_process_onlyr   c                     t               st        d      t        |      dkD  rt        |d   t              rt        d      |j                  dd      }| r|st               j                  dk7  }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   zPassing `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
   s       P/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/accelerate/utils/tqdm.pyr   r      s     vww
4y1}DGT2K
 	
 jjE*G.449$2&2'22    N)importsr   	tqdm.autor   r   stater   r    r   r   <module>r      s)     ' '   +/ 34 3r   