Ë
    Q^(hj  ã                   ó¸   — d dl Z d dlZd dlmZ d dlmZmZ d dlmZm	Z	m
Z
mZmZ eZeZe
d   Ze G d„ d«      «       Ze G d„ d	«      «       Ze G d
„ d«      «       Zy)é    N)Údefaultdict)Ú	dataclassÚfield)ÚDictÚListÚLiteralÚOptionalÚTuple)
ÚF64ÚF32ÚF16ÚBF16ÚI64ÚI32ÚI16ÚI8ÚU8ÚBOOLc                   ód   — e Zd ZU dZeed<   ee   ed<   eeef   ed<    e	d¬«      Z
eed<   d
d	„Zy)Ú
TensorInfoa<  Information about a tensor.

    For more details regarding the safetensors format, check out https://huggingface.co/docs/safetensors/index#format.

    Attributes:
        dtype (`str`):
            The data type of the tensor ("F64", "F32", "F16", "BF16", "I64", "I32", "I16", "I8", "U8", "BOOL").
        shape (`List[int]`):
            The shape of the tensor.
        data_offsets (`Tuple[int, int]`):
            The offsets of the data in the file as a tuple `[BEGIN, END]`.
        parameter_count (`int`):
            The number of parameters in the tensor.
    ÚdtypeÚshapeÚdata_offsetsF©ÚinitÚparameter_countNc                 ó˜   — 	 t        j                  t        j                  | j                  «      | _        y # t        $ r
 d| _        Y y w xY w)Né   )Ú	functoolsÚreduceÚoperatorÚmulr   r   Ú	TypeError)Úselfs    ú`/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/huggingface_hub/utils/_safetensors.pyÚ__post_init__zTensorInfo.__post_init__#   s;   € ð	%Ü#,×#3Ñ#3´H·L±LÀ$Ç*Á*Ó#MˆDÕ øÜò 	%Ø#$ˆDÖ ð	%ús   ‚36 ¶A	ÁA	©ÚreturnN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚDTYPE_TÚ__annotations__r   Úintr
   r   r   r&   © ó    r%   r   r      s:   … ñð ƒNØ�‰9ÓØ˜˜S˜‘/Ó!Ù  eÔ,€O�SÓ,ô%r1   r   c                   óh   — e Zd ZU dZeeef   ed<   eeef   ed<    e	d¬«      Z
eeef   ed<   d	d„Zy)
ÚSafetensorsFileMetadataaÙ  Metadata for a Safetensors file hosted on the Hub.

    This class is returned by [`parse_safetensors_file_metadata`].

    For more details regarding the safetensors format, check out https://huggingface.co/docs/safetensors/index#format.

    Attributes:
        metadata (`Dict`):
            The metadata contained in the file.
        tensors (`Dict[str, TensorInfo]`):
            A map of all tensors. Keys are tensor names and values are information about the corresponding tensor, as a
            [`TensorInfo`] object.
        parameter_count (`Dict[str, int]`):
            A map of the number of parameters per data type. Keys are data types and values are the number of parameters
            of that data type.
    ÚmetadataÚtensorsFr   r   Nc                 óÂ   — t        t        «      }| j                  j                  «       D ]#  }||j                  xx   |j
                  z  cc<   Œ% t        |«      | _        y ©N)r   r/   r5   Úvaluesr   r   Údict)r$   r   Útensors      r%   r&   z%SafetensorsFileMetadata.__post_init__B   sQ   € Ü.9¼#Ó.>ˆØ—l‘l×)Ñ)Ó+ò 	DˆFØ˜FŸL™LÓ)¨V×-CÑ-CÑCÔ)ð	Dä# OÓ4ˆÕr1   r'   )r)   r*   r+   r,   r   Ústrr.   ÚTENSOR_NAME_Tr   r   r   r-   r/   r&   r0   r1   r%   r3   r3   +   sD   … ñð" �3˜�8‰nÓØ�- Ð+Ñ,Ó,Ù*/°UÔ*;€O�T˜' 3˜,Ñ'Ó;ô5r1   r3   c                   ó‚   — e Zd ZU dZee   ed<   eed<   eee	f   ed<   ee	e
f   ed<    ed¬«      Zeeef   ed<   dd
„Zy	)ÚSafetensorsRepoMetadataa  Metadata for a Safetensors repo.

    A repo is considered to be a Safetensors repo if it contains either a 'model.safetensors' weight file (non-shared
    model) or a 'model.safetensors.index.json' index file (sharded model) at its root.

    This class is returned by [`get_safetensors_metadata`].

    For more details regarding the safetensors format, check out https://huggingface.co/docs/safetensors/index#format.

    Attributes:
        metadata (`Dict`, *optional*):
            The metadata contained in the 'model.safetensors.index.json' file, if it exists. Only populated for sharded
            models.
        sharded (`bool`):
            Whether the repo contains a sharded model or not.
        weight_map (`Dict[str, str]`):
            A map of all weights. Keys are tensor names and values are filenames of the files containing the tensors.
        files_metadata (`Dict[str, SafetensorsFileMetadata]`):
            A map of all files metadata. Keys are filenames and values are the metadata of the corresponding file, as
            a [`SafetensorsFileMetadata`] object.
        parameter_count (`Dict[str, int]`):
            A map of the number of parameters per data type. Keys are data types and values are the number of parameters
            of that data type.
    r4   ÚshardedÚ
weight_mapÚfiles_metadataFr   r   Nc                 óÞ   — t        t        «      }| j                  j                  «       D ]1  }|j                  j                  «       D ]  \  }}||xx   |z  cc<   Œ Œ3 t        |«      | _        y r7   )r   r/   rA   r8   r   Úitemsr9   )r$   r   Úfile_metadatar   Únb_parameters_s        r%   r&   z%SafetensorsRepoMetadata.__post_init__j   sl   € Ü.9¼#Ó.>ˆØ!×0Ñ0×7Ñ7Ó9ò 	9ˆMØ)6×)FÑ)F×)LÑ)LÓ)Nò 9Ñ%��~Ø Ó&¨.Ñ8Ô&ñ9ð	9ô  $ OÓ4ˆÕr1   r'   )r)   r*   r+   r,   r	   r   r.   Úboolr<   Ú
FILENAME_Tr3   r   r   r-   r/   r&   r0   r1   r%   r>   r>   I   sV   … ñð2 �t‰nÓØƒMØ�] JÐ.Ñ/Ó/Ø˜Ð%<Ð<Ñ=Ó=Ù*/°UÔ*;€O�T˜' 3˜,Ñ'Ó;ô5r1   r>   )r   r!   Úcollectionsr   Údataclassesr   r   Útypingr   r   r   r	   r
   r;   rG   r<   r-   r   r3   r>   r0   r1   r%   ú<module>rK      sy   ðÛ Û Ý #ß (ß 7Õ 7ð €
Ø€Ø
ÐVÑ
W€ð ÷%ð %ó ð%ð: ÷5ð 5ó ð5ð: ÷%5ð %5ó ñ%5r1   