§
    ìXÊjV  ã                   óÔ   — 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 e	Z
e	Zed         Ze G d„ d¦  «        ¦   «         Ze G d„ d	¦  «        ¦   «         Ze G d
„ d¦  «        ¦   «         ZdS )é    N)Údefaultdict)Ú	dataclassÚfield)ÚLiteral)ÚF64ÚF32ÚF16ÚBF16ÚI64ÚI32ÚI16ÚI8ÚU8ÚU3ÚBOOLc                   óx   — 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d	S )Ú
TensorInfoaB  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", "U3", "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_countÚreturnNc                 óŠ   — 	 t          j        t          j        | j        ¦  «        | _        d S # t          $ r d| _        Y d S w xY w)Né   )Ú	functoolsÚreduceÚoperatorÚmulr   r   Ú	TypeError)Úselfs    úSC:\Projects\Historical\venv\Lib\site-packages\huggingface_hub/utils/_safetensors.pyÚ__post_init__zTensorInfo.__post_init__#   sR   € ð	%Ý#,Ô#3µH´LÀ$Ä*Ñ#MÔ#MˆDÔ Ð Ð øÝð 	%ð 	%ð 	%Ø#$ˆDÔ Ð Ð Ð ð	%øøøs   ‚)- ­AÁA©r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚDTYPE_TÚ__annotations__ÚlistÚintÚtupler   r   r$   © ó    r#   r   r      s€   € € € € € € ðð ð €N€N�NØ�Œ9ÐÐÑØ˜˜S˜”/Ð!Ð!Ñ!Ø ˜5 eÐ,Ñ,Ô,€O�SÐ,Ð,Ñ,ð%ð %ð %ð %ð %ð %r0   r   c                   ó‚   — 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dS )Ú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   r   Nc                 óÂ   — t          t          ¦  «        }| j                             ¦   «         D ]}||j        xx         |j        z  cc<   Œt          |¦  «        | _        d S ©N)r   r-   r4   Úvaluesr   r   Údict)r"   r   Útensors      r#   r$   z%SafetensorsFileMetadata.__post_init__B   sh   € Ý.9½#Ñ.>Ô.>ˆØ”l×)Ò)Ñ+Ô+ð 	Dð 	DˆFØ˜FœLÐ)Ð)Ô)¨VÔ-CÑCÐ)Ð)Ñ)Ð)Ý# OÑ4Ô4ˆÔÐÐr0   r%   )r&   r'   r(   r)   r8   Ústrr+   ÚTENSOR_NAME_Tr   r   r   r*   r-   r$   r/   r0   r#   r2   r2   +   s†   € € € € € € ðð ð" �3˜�8ŒnÐÐÑØ�- Ð+Ô,Ð,Ð,Ñ,Ø*/¨%°UÐ*;Ñ*;Ô*;€O�T˜' 3˜,Ô'Ð;Ð;Ñ;ð5ð 5ð 5ð 5ð 5ð 5r0   r2   c                   óœ   — e Zd ZU dZedz  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dS )Ú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.
    Nr3   ÚshardedÚ
weight_mapÚfiles_metadataFr   r   r   c                 óì   — t          t          ¦  «        }| j                             ¦   «         D ]1}|j                             ¦   «         D ]\  }}||xx         |z  cc<   ŒŒ2t          |¦  «        | _        d S r6   )r   r-   r@   r7   r   Úitemsr8   )r"   r   Úfile_metadatar   Únb_parameters_s        r#   r$   z%SafetensorsRepoMetadata.__post_init__j   sŠ   € Ý.9½#Ñ.>Ô.>ˆØ!Ô0×7Ò7Ñ9Ô9ð 	9ð 	9ˆMØ)6Ô)F×)LÒ)LÑ)NÔ)Nð 9ð 9Ñ%��~Ø Ð&Ð&Ô&¨.Ñ8Ð&Ð&Ñ&Ð&ð9å# OÑ4Ô4ˆÔÐÐr0   r%   )r&   r'   r(   r)   r8   r+   Úboolr;   Ú
FILENAME_Tr2   r   r   r*   r-   r$   r/   r0   r#   r=   r=   I   s¢   € € € € € € ðð ð2 �T‰kÐÐÑØ€M€M�MØ�] JÐ.Ô/Ð/Ð/Ñ/Ø˜Ð%<Ð<Ô=Ð=Ð=Ñ=Ø*/¨%°UÐ*;Ñ*;Ô*;€O�T˜' 3˜,Ô'Ð;Ð;Ñ;ð5ð 5ð 5ð 5ð 5ð 5r0   r=   )r   r   Úcollectionsr   Údataclassesr   r   Útypingr   r:   rF   r;   r*   r   r2   r=   r/   r0   r#   ú<module>rJ      s  ðØ Ð Ð Ð Ø €€€Ø #Ð #Ð #Ð #Ð #Ð #Ø (Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ø Ð Ð Ð Ð Ð ð €
Ø€Ø
Ð\Ô
]€ð ð%ð %ð %ð %ð %ñ %ô %ñ „ð%ð: ð5ð 5ð 5ð 5ð 5ñ 5ô 5ñ „ð5ð: ð%5ð %5ð %5ð %5ð %5ñ %5ô %5ñ „ð%5ð %5ð %5r0   