
     ip                         d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	  G d de      Z
	 	 	 	 dd	ed
e
ez  dedz  dedz  deez  dz  deez  dz  dedz  fdZy)    )Enum)Path)hf_hub_download)HfHubHTTPError)__version__c                   $    e Zd ZdZdZdZdefdZy)AssetFileNamezcalibration.safetensorszpytorch_model.binzconfig.yamlreturnc                     | j                   S )N)value)selfs    p/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/pyannote/audio/utils/hf_hub.py__str__zAssetFileName.__str__(   s    zz    N)__name__
__module____qualname__CalibrationModelPipelinestrr    r   r   r	   r	   #   s    +KEH r   r	   Nmodel_id
asset_file	subfolderrevision	cache_dirtokenr
   c                 F   t        |t              r|j                  d      sd}	 t        | t        |t              r|j
                  n||d|dt        ||	      S # t        $ r> t        |t              r|j                  n|}t        d| d|  d|  d	| d
| d|  d        w xY w)a  Download file from Huggingface Hub

    Parameters
    ----------
    model_id : str
        Model identifier from the hf.co model hub.
    asset_file : AssetFileName
        Type of asset file to download.
    subfolder : str, optional
        Folder inside the model repo.
    revision : str, optional
        Revision when loading from the huggingface.co model hub.
    token : str or bool, optional
        Huggingface token to be used for downloading from Huggingface hub.
    cache_dir: Path or str, optional
        Path to the folder where files downloaded from Huggingface hub are stored.

    See also
    --------
    `huggingface_hub.hf_hub_download`
    hf_Nmodelpyannote)r   	repo_typer   library_namelibrary_versionr   r   z
Could not download z from zQ.
It might be because the repository is private or gated:

* visit https://hf.co/zn to accept user conditions
* visit https://hf.co/settings/tokens to create an authentication token
* load the z$ with the `token` argument:
    >>> z.from_pretrained('z', token='hf_....')
)

isinstancer   
startswithr   r	   r   r   r   nameprint)r   r   r   r   r   r   asset_file_names          r   download_from_hf_hubr+   ,   s    @ %e&6&6u&= *:} EJ:#'

 
	
  2<Z2Wz]g#$F8* 5  j ! 		+H: 6
	
 	s   3A AB )NNNN)enumr   pathlibr   huggingface_hubr   huggingface_hub.utilsr   pyannote.audior   r	   r   boolr+   r   r   r   <module>r2      s   0   + 0 &
D  !#'#<<#< Tz< Dj	<
 TzD < #:< 	4Z<r   