§
    AxÅjl	  ã            	       ód   — d Z ddlZddlmZ  e¦   «         Z	 d	dededej        edf         fd„ZdS )
zQUtility function for transforming HuggingFace repositories into model-cache pathsé    N)ÚRunPodLoggerú /runpod/cache/{model}/{revision}Úpath_templateÚhuggingface_repositoryÚreturnc                ó¸   — |                       dd¦  «        ^}}|s t                               d| › d�¦  «         dS |                     ||r|d         nd¬¦  «        S )	a–  
    Resolves the model-cache path for a HuggingFace model based on its repository string.

    Args:
        huggingface_repository (str): Repository string in format "model_name:revision" or
                                    "org/model_name:revision". If no revision is specified,
                                    "main" is used. For example:
                                    - "runwayml/stable-diffusion-v1-5:experimental"
                                    - "runwayml/stable-diffusion-v1-5" (uses "main" revision)
                                    - "stable-diffusion-v1-5:main"
        path_template (str, optional): Template string for the cache path. Must contain {model}
                                     and {revision} placeholders. Defaults to "/runpod/cache/{model}/{revision}".

    Returns:
        str | None: Absolute path where the model is cached, following the template provided in path_template. Returns None if no model name could be extracted.

    Examples:
        >>> resolve_model_cache_path_from_hugginface_repository("runwayml/stable-diffusion-v1-5:experimental")
        "/runpod/cache/runwayml/stable-diffusion-v1-5/experimental"
        >>> resolve_model_cache_path_from_hugginface_repository("runwayml/stable-diffusion-v1-5")
        "/runpod/cache/runwayml/stable-diffusion-v1-5/main"
        >>> resolve_model_cache_path_from_hugginface_repository(":experimental")
        None
    ú:é   z,Unable to resolve the model-cache path for "ú"Nr   Úmain)ÚmodelÚrevision)ÚrsplitÚlogÚwarnÚformat)r   r   r   r   s       úWC:\Projects\Historical\venv\Lib\site-packages\runpod/serverless/utils/rp_model_cache.pyÚ3resolve_model_cache_path_from_hugginface_repositoryr   	   s�   € ð: .×4Ò4°S¸!Ñ<Ô<Ð€EˆHØð å�ŠØTÐ;QÐTÐTÐTñ	
ô 	
ð 	
ð ˆtØ×ÒØ¨XÐA˜h qœk˜k¸6ð  ñ ô ð ó    )r   )Ú__doc__ÚtypingÚ#runpod.serverless.modules.rp_loggerr   r   ÚstrÚUnionr   © r   r   ú<module>r      s€   ðØ WÐ Wà €€€Ø <Ð <Ð <Ð <Ð <Ð <à€l�n„n€ð <ð&ð &ð ð&Øð&ð „\�#�t�)Ôð	&ð &ð &ð &ð &ð &r   