ó
    pyüi"  ã                   óR   • S SK r S SKrS SKrS SKJr  S SKJr  \ " S S5      5       rg)é    N)Ú	dataclass)ÚAnyc                   ó�   • \ rS rSr% SrSr\\S'   \S 5       r	S\
\R                  -  4S jrS\\
\4   4S	 jrS
 rS rS rS rSrg)ÚDistributedConfigé   z$
Base class for distributed configs
FÚenable_expert_parallelc                 óà   • U " S0 UD6n/ nUR                  5        H4  u  pV[        X55      (       d  M  [        X5U5        UR                  U5        M6     U H  nUR	                  US5        M     U$ )aK  
Constructs a DistributedConfig instance from a dictionary of parameters.
Args:
    config_dict (Dict[str, Any]): Dictionary containing configuration parameters.
    **kwargs: Additional keyword arguments to override dictionary values.
Returns:
    DistributedConfig: Instance of DistributedConfig constructed from the dictionary.
N© )ÚitemsÚhasattrÚsetattrÚappendÚpop)ÚclsÚconfig_dictÚkwargsÚconfigÚ	to_removeÚkeyÚvalues          Úi/home/mande/repo/quber/.venv/lib/python3.13/site-packages/transformers/distributed/configuration_utils.pyÚ	from_dictÚDistributedConfig.from_dict   sj   € ñ Ñ#�{Ñ#ˆØˆ	Ø Ÿ,™,ž.‰JˆCÜ�v×#Ó#Ü˜ UÔ+Ø× Ñ  Ö%ñ )ó ˆCØ�J‰J�s˜DÖ!ñ àˆó    Újson_file_pathc                 óÂ   • [        USSS9 nU R                  5       n[        R                  " USSS9S-   nUR	                  U5        SSS5        g! , (       d  f       g= f)	a‚  
Save this instance to a JSON file.
Args:
    json_file_path (`str` or `os.PathLike`):
        Path to the JSON file in which this configuration instance's parameters will be saved.
    use_diff (`bool`, *optional*, defaults to `True`):
        If set to `True`, only the difference between the config instance and the default
        `QuantizationConfig()` is serialized to JSON file.
Úwzutf-8)Úencodingé   T)ÚindentÚ	sort_keysÚ
N)ÚopenÚto_dictÚjsonÚdumpsÚwrite)Úselfr   Úwriterr   Újson_strings        r   Úto_json_fileÚDistributedConfig.to_json_file4   sL   € ô �. #°Ò8¸FØŸ,™,›.ˆKÜŸ*š* [¸ÀdÑKÈdÑRˆKà�L‰L˜Ô%÷	 9×8Ö8ús   Œ;AÁ
AÚreturnc                 óB   • [         R                  " U R                  5      $ )zœ
Serializes this instance to a Python dictionary. Returns:
    `Dict[str, Any]`: Dictionary of all the attributes that make up this configuration instance.
)ÚcopyÚdeepcopyÚ__dict__©r(   s    r   r$   ÚDistributedConfig.to_dictD   s   € ô
 �}Š}˜TŸ]™]Ó+Ð+r   c              #   ó|   #   • [         R                  " U R                  5      R                  5        Sh  v•N   g N7f)zTallows `dict(obj)` for situations where obj may be a dict or QuantizationConfigMixinN)r/   r0   r1   r   r2   s    r   Ú__iter__ÚDistributedConfig.__iter__L   s$   é € ä—=’= §¡Ó/×5Ñ5Ó7×7Ó7ùs   ‚2<´:µ<c                 óT   • U R                   R                   SU R                  5        3$ )NÚ )Ú	__class__Ú__name__Úto_json_stringr2   s    r   Ú__repr__ÚDistributedConfig.__repr__Q   s(   € Ø—.‘.×)Ñ)Ð*¨!¨D×,?Ñ,?Ó,AÐ+BÐCÐCr   c                 óF   • [         R                  " U R                  SS9S-   $ )z‡
Serializes this instance to a JSON formatted string.
Returns:
    str: JSON formatted string representing the configuration instance.
r   )r    r"   )r%   r&   r1   r2   s    r   r;   Ú DistributedConfig.to_json_stringT   s   € ô �zŠz˜$Ÿ-™-°Ñ2°TÑ9Ð9r   c                 óü   • / nUR                  5        H4  u  p4[        X5      (       d  M  [        XU5        UR                  U5        M6     UR                  5        VVs0 s H  u  p4X2;  d  M  X4_M     nnnU$ s  snnf )am  
Updates attributes of this class instance with attributes from `kwargs` if they match existing attributes,
returning all the unused kwargs.
Args:
    kwargs (`Dict[str, Any]`):
        Dictionary of attributes to tentatively update this class.
Returns:
    `Dict[str, Any]`: Dictionary containing all the key-value pairs that were not used to update the instance.
)r   r   r   r   )r(   r   r   r   r   Úunused_kwargss         r   ÚupdateÚDistributedConfig.update\   sq   € ð ˆ	Ø Ÿ,™,ž.‰JˆCÜ�t×!Ó!Ü˜ 5Ô)Ø× Ñ  Ö%ñ )ð 7=·l±l´nÔ]²n©
¨ÈÑH\›˜š±nˆÑ]ØÐùó ^s   ÁA8Á-A8r
   N)r:   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   ÚboolÚ__annotations__Úclassmethodr   ÚstrÚosÚPathLiker+   Údictr   r$   r5   r<   r;   rB   Ú__static_attributes__r
   r   r   r   r      sf   ‡ ñð $)Ð˜DÓ(ð ñó ðð(&¨3°·±Ñ+<ô &ð ,˜˜c 3˜h™ô ,ò8ò
Dò:õr   r   )r/   r%   rL   Údataclassesr   Útypingr   r   r
   r   r   Ú<module>rR      s2   ðó Û Û 	Ý !Ý ð ÷Wð Wó ñWr   