+
    IV-j‰  ã                   óê  € ^ RI t ^ RIt^ RIHtHtHtHt ^ RIt^ RI	H
t
HtHtHtHt R R ltR#R R lltR#R R	 lltR
 R ltRR/R R lltR]P(                  R]P*                  R]P,                  R]P.                  R]P0                  R]P2                  R]P4                  R]P6                  R]P8                  R]P:                  R]P<                  R]R]P@                  /t!R R lt"R R  lt#R! R" lt$R# )$é    N)ÚDictÚListÚOptionalÚUnion)Ú
TensorSpecÚdeserializeÚ	safe_openÚ	serializeÚserialize_filec                ó”   € V ^8„  d   QhR\         \        \        P                  3,          R\        R\         \        \         3,          /# )é   Útensor_dictÚkeep_alive_bufferÚreturn)r   ÚstrÚnpÚndarrayr   )Úformats   "Úb/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/safetensors/numpy.pyÚ__annotate__r   
   s9   € ÷ ñ Ü”cœ2Ÿ:™:�oÕ&ðÜ;?ðä	Œ#Œtˆ)…_ñó    c                 óB  € / pV P                  4        Fˆ  w  r4Tp\        V4      '       g$   VP                  R R7      pVP                  V4       \	        VP
                  P                  VP                  VP                  P                  VP                  R7      W#&   KŠ  	  V# )F)Úinplace)ÚdtypeÚshapeÚdata_ptrÚdata_len)ÚitemsÚ_is_little_endianÚbyteswapÚappendr   r   Únamer   ÚctypesÚdataÚnbytes)r   r   Ú	flattenedÚkÚvÚtensors   &&    r   Ú_flattenr*   
   sˆ   € ð €IØ×!Ñ!Ö#‰ˆØˆÜ  ×(Ò(Ø—_‘_¨U�_Ó3ˆFØ×$Ñ$ VÔ,Ü!Ø—,‘,×#Ñ#Ø—,‘,Ø—]‘]×'Ñ'Ø—]‘]ô	
ˆ	‹ñ $ð Ðr   c                óª   € V ^8„  d   QhR\         \        \        P                  3,          R\        \         \        \        3,          ,          R\
        /# )r   r   Úmetadatar   )r   r   r   r   r   Úbytes)r   s   "r   r   r      s>   € ÷ ñ Ü”cœ2Ÿ:™:�oÕ&ðÜ2:¼4ÄÄSÀ½>Õ2Jðä
ñr   c                óL   € . p\        \        W4      VR7      p\        V4      pV# )aÞ  
Saves a dictionary of tensors into raw bytes in safetensors format.

Args:
    tensor_dict (`Dict[str, np.ndarray]`):
        The incoming tensors. Tensors need to be contiguous and dense.
    metadata (`Dict[str, str]`, *optional*, defaults to `None`):
        Optional text only metadata you might want to save in your header.
        For instance it can be useful to specify more about the underlying
        tensors. This is purely informative and does not affect tensor loading.

Returns:
    `bytes`: The raw bytes representing the format

Example:

```python
from safetensors.numpy import save
import numpy as np

tensors = {"embedding": np.zeros((512, 1024)), "attention": np.zeros((256, 256))}
byte_data = save(tensors)
```
©r,   )r
   r*   r-   )r   r,   r   Ú
serializedÚresults   &&   r   Úsaver2      s*   € ð6 ÐÜœ8 KÓCÈhÔW€JÜ�:Ó€FØ€Mr   c          	      óä   € V ^8„  d   QhR\         \        \        P                  3,          R\        \        \
        P                  3,          R\        \         \        \        3,          ,          RR/# )r   r   Úfilenamer,   r   N)r   r   r   r   r   ÚosÚPathLiker   )r   s   "r   r   r   =   sX   € ÷ "ñ "Ü”cœ2Ÿ:™:�oÕ&ð"ä”CœŸ™Ð$Õ%ð"ô ”tœC¤˜H•~Õ&ð"ð 
ñ	"r   c                ó6   € . p\        \        W4      WR7       R# )a  
Saves a dictionary of tensors into raw bytes in safetensors format.

Args:
    tensor_dict (`Dict[str, np.ndarray]`):
        The incoming tensors. Tensors need to be contiguous and dense.
    filename (`str`, or `os.PathLike`)):
        The filename we're saving into.
    metadata (`Dict[str, str]`, *optional*, defaults to `None`):
        Optional text only metadata you might want to save in your header.
        For instance it can be useful to specify more about the underlying
        tensors. This is purely informative and does not affect tensor loading.

Returns:
    `None`

Example:

```python
from safetensors.numpy import save_file
import numpy as np

tensors = {"embedding": np.zeros((512, 1024)), "attention": np.zeros((256, 256))}
save_file(tensors, "model.safetensors")
```
r/   N)r   r*   )r   r4   r,   r   s   &&& r   Ú	save_filer8   =   s   € ð> ÐÜÜ�Ó0°(÷r   c                óf   € V ^8„  d   QhR\         R\        \        \        P                  3,          /# )r   r$   r   )r-   r   r   r   r   )r   s   "r   r   r   b   s'   € ÷ ñ Œuð œœc¤2§:¡:˜oÕ.ñ r   c                ó.   € \        V 4      p\        V4      # )až  
Loads a safetensors file into numpy format from pure bytes.

Args:
    data (`bytes`):
        The content of a safetensors file

Returns:
    `Dict[str, np.ndarray]`: dictionary that contains name as key, value as `np.ndarray` on cpu

Example:

```python
from safetensors.numpy import load

file_path = "./my_folder/bert.safetensors"
with open(file_path, "rb") as f:
    data = f.read()

loaded = load(data)
```
)r   Ú_view2np)r$   Úflats   & r   Úloadr=   b   s   € ô. �tÓ€DÜ�D‹>Ðr   ÚbackendÚmmapc                ó¨   € V ^8„  d   QhR\         \        \        P                  3,          R\        R\        \        \
        P                  3,          /# )r   r4   r>   r   )r   r   r5   r6   r   r   r   )r   s   "r   r   r   }   s?   € ÷ ñ Ü”CœŸ™Ð$Õ%ðÜ36ðä	Œ#Œr�z‰zˆ/Õñr   c               óŒ   € \        V RVR7      ;_uu_ 4       pVP                  4       uuRRR4       #   + '       g   i     R# ; i)a=  
Loads a safetensors file into numpy format.

Args:
    filename (`str`, or `os.PathLike`)):
        The name of the file which contains the tensors
    backend (`str`, *optional*, defaults to `"mmap"`):
        Storage backend used to serve tensor bytes. `"mmap"` (default)
        and `"pread"` uses `pread(2)` to read tensor bytes.

Returns:
    `Dict[str, np.ndarray]`: dictionary that contains name as key, value as `np.ndarray`

Example:

```python
from safetensors.numpy import load_file

file_path = "./my_folder/bert.safetensors"
loaded = load_file(file_path)
```
r   )Ú	frameworkr>   N)r	   Úget_tensors)r4   r>   Úfs   &$ r   Ú	load_filerE   }   s-   € ô2 
�8 t°W×	=Õ	=ÀØ�}‰}‹÷ 
>×	=×	=Ó	=ús	   —2²A	ÚF64ÚF32ÚF16ÚI64ÚU64ÚI32ÚU32ÚI16ÚU16ÚI8ÚU8ÚBOOLÚC64c                óD   € V ^8„  d   QhR\         R\        P                  /# )r   Ú	dtype_strr   )r   r   r   )r   s   "r   r   r   «   s   € ÷ ñ œð ¤§¡ñ r   c                 ó   € \         V ,          # ©N)Ú_TYPES)rT   s   &r   Ú	_getdtyperX   «   s   € Ü�)ÕÐr   c                óZ   € V ^8„  d   QhR\         \        \        P                  3,          /# )r   r   )r   r   r   r   )r   s   "r   r   r   ¯   s    € ÷ ñ œ$œs¤B§J¡J˜Õ/ñ r   c                 ó¶   € / pV  FP  w  r#\        VR ,          4      p\        P                  ! VR,          VR7      P                  VR,          4      pWQV&   KR  	  V# )r   r$   )r   r   )rX   r   Ú
frombufferÚreshape)Úsafeviewr1   r'   r(   r   Úarrs   &     r   r;   r;   ¯   sR   € Ø€FÛ‰ˆÜ˜!˜G�*Ó%ˆÜ�mŠm˜A˜f�I¨UÔ3×;Ñ;¸A¸g½JÓGˆØˆq‹	ñ ð €Mr   c                óD   € V ^8„  d   QhR\         P                  R\        /# )r   r)   r   )r   r   Úbool)r   s   "r   r   r   ¸   s   € ÷ ;ñ ;œbŸj™jð ;¬Tñ ;r   c                 óÀ   € V P                   P                  pVR 8X  d   \        P                  R8X  d   R# R# VR8X  d   R# VR8X  d   R# VR8X  d   R# \        RV 24      h)Ú=ÚlittleTFÚ|Ú<Ú>zUnexpected byte order )r   Ú	byteorderÚsysÚ
ValueError)r)   rg   s   & r   r   r   ¸   s_   € Ø—‘×&Ñ&€IØ�CÔÜ�=‰=˜HÔ$ÙáØ	�cÔ	ÙØ	�cÔ	ÙØ	�cÔ	ÙÜ
Ð-¨i¨[Ð9Ó
:Ð:r   rV   )%r5   rh   Útypingr   r   r   r   Únumpyr   Úsafetensorsr   r   r	   r
   r   r*   r2   r8   r=   rE   Úfloat64Úfloat32Úfloat16Úint64Úuint64Úint32Úuint32Úint16Úuint16Úint8Úuint8r`   Ú	complex64rW   rX   r;   r   © r   r   Ú<module>rz      sÆ   ðÛ 	Û 
ß .Ó .ã ç UÕ Uõ÷$÷B"õJð6Ø9?÷ð< 
ˆ2�:‰:Ø	ˆ2�:‰:Ø	ˆ2�:‰:Ø	ˆ2�8‰8Ø	ˆ2�9‰9Ø	ˆ2�8‰8Ø	ˆ2�9‰9Ø	ˆ2�8‰8Ø	ˆ2�9‰9Øˆ"�'‰'Øˆ"�(‰(Ø
ˆDØ	ˆ2�<‰<ð
€õ"õ÷;r   