ó
    pyüiJ  ã                   ó¨   • S SK r S SKrS SKJr  S SKJrJr  S SKJr  \	r
\	r\S   r\ " S S5      5       r\ " S S	5      5       r\ " S
 S5      5       rg)é    N)Údefaultdict)Ú	dataclassÚfield)ÚLiteral)
ÚF64ÚF32ÚF16ÚBF16ÚI64ÚI32ÚI16ÚI8ÚU8ÚBOOLc                   óh   • \ rS rSr% Sr\\S'   \\   \S'   \	\\4   \S'   \
" SS9r\\S'   SS
 jrSrg	)Ú
TensorInfoé   a  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                 óœ   •  [         R                  " [        R                  U R                  5      U l        g ! [         a
    SU l         g f = f)Né   )Ú	functoolsÚreduceÚoperatorÚmulr   r   Ú	TypeError)Úselfs    Ú_/home/mande/repo/quber/.venv/lib/python3.13/site-packages/huggingface_hub/utils/_safetensors.pyÚ__post_init__ÚTensorInfo.__post_init__#   s;   € ð	%Ü#,×#3Ò#3´H·L±LÀ$Ç*Á*Ó#MˆDÕ øÜó 	%Ø#$ˆDÖ ð	%ús   ‚47 ·AÁ
A©r   ©ÚreturnN)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚDTYPE_TÚ__annotations__ÚlistÚintÚtupler   r   r#   Ú__static_attributes__© ó    r"   r   r      s:   ‡ ñð ƒNØ�‰9ÓØ˜˜S˜‘/Ó!Ù  eÑ,€O�SÓ,÷%r4   r   c                   ól   • \ rS rSr% Sr\\\4   \S'   \\\	4   \S'   \
" SS9r\\\4   \S'   SS	 jrS
rg)ÚSafetensorsFileMetadataé+   a©  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                 óÄ   • [        [        5      nU R                  R                  5        H#  nXR                  ==   UR
                  -  ss'   M%     [        U5      U l        g ©N)r   r0   r9   Úvaluesr   r   Údict)r!   r   Útensors      r"   r#   Ú%SafetensorsFileMetadata.__post_init__B   sH   € Ü.9¼#Ó.>ˆØ—l‘l×)Ñ)Ö+ˆFØŸL™LÓ)¨V×-CÑ-CÑCÕ)ñ ,ä# OÓ4ˆÕr4   r%   r&   )r(   r)   r*   r+   r,   r=   Ústrr.   ÚTENSOR_NAME_Tr   r   r   r-   r0   r#   r2   r3   r4   r"   r6   r6   +   sD   ‡ ñð" �3˜�8‰nÓØ�- Ð+Ñ,Ó,Ù*/°UÑ*;€O�T˜' 3˜,Ñ'Ó;÷5r4   r6   c                   ó†   • \ rS rSr% Sr\S-  \S'   \\S'   \\\	4   \S'   \\	\
4   \S'   \" SS	9r\\\4   \S
'   SS jrSrg)ÚSafetensorsRepoMetadataéI   aÀ  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.
Nr8   ÚshardedÚ
weight_mapÚfiles_metadataFr   r   c                 óâ   • [        [        5      nU R                  R                  5        H2  nUR                  R                  5        H  u  p4X==   U-  ss'   M     M4     [        U5      U l        g r;   )r   r0   rG   r<   r   Úitemsr=   )r!   r   Úfile_metadatar   Únb_parameters_s        r"   r#   Ú%SafetensorsRepoMetadata.__post_init__j   s_   € Ü.9¼#Ó.>ˆØ!×0Ñ0×7Ñ7Ö9ˆMØ)6×)FÑ)F×)LÑ)LÖ)NÑ%�ØÓ&¨.Ñ8Õ&ó *Oñ :ô  $ OÓ4ˆÕr4   r%   r&   )r(   r)   r*   r+   r,   r=   r.   ÚboolrA   Ú
FILENAME_Tr6   r   r   r-   r0   r#   r2   r3   r4   r"   rC   rC   I   sV   ‡ ñð2 �T‰kÓØƒMØ�] JÐ.Ñ/Ó/Ø˜Ð%<Ð<Ñ=Ó=Ù*/°UÑ*;€O�T˜' 3˜,Ñ'Ó;÷5r4   rC   )r   r   Úcollectionsr   Údataclassesr   r   Útypingr   r@   rN   rA   r-   r   r6   rC   r3   r4   r"   Ú<module>rR      sv   ðÛ Û Ý #ß (Ý ð €
Ø€Ø
ÐVÑ
W€ð ÷%ð %ó ð%ð: ÷5ð 5ó ð5ð: ÷%5ð %5ó ñ%5r4   