+
    Lj                     j   R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	 ^ RI
Ht ^ RIHt ^ RIt^ RIHtHtHt ^ RIHtHtHtHtHt ^ RIHt ^RIHt ^R	IHtH t H!t!H"t"H#t#H$t$ ]$PJ                  ! ]&4      t']PP                  ! R
4      t) ! R R]	4      t* ! R R4      t+R t,R t- ! R R]+4      t.R# )z%ConfigMixin base class and utilities.N)OrderedDict)Path)Any)	DDUFEntrycreate_repohf_hub_download)EntryNotFoundErrorHfHubHTTPErrorRepositoryNotFoundErrorRevisionNotFoundErrorvalidate_hf_hub_args)Self)__version__)HUGGINGFACE_CO_RESOLVE_ENDPOINTDummyObject	deprecateextract_commit_hashhttp_user_agentloggingzconfig\.(.*)\.jsonc                   b   a a ] tR t^8t oV 3R ltR tR tR tR tV 3R lt	V 3R lt
RtVtV ;t# )	
FrozenDictc                   < \         SV `  ! V/ VB  V P                  4        F  w  r4\        WV4       K  	  R V n        R# )TN)super__init__itemssetattr_FrozenDict__frozen)selfargskwargskeyvalue	__class__s   &*,  I/app/.local/lib/python3.14/site-packages/diffusers/configuration_utils.pyr   FrozenDict.__init__9   s:    $)&)**,JCDu% '     c                H    \        R V P                  P                   R24      h)z$You cannot use ``__delitem__`` on a 
 instance.	Exceptionr"   __name__r   r   r   s   &*,r#   __delitem__FrozenDict.__delitem__A   s#    >t~~?V?V>WWabccr%   c                H    \        R V P                  P                   R24      h)z#You cannot use ``setdefault`` on a r'   r(   r+   s   &*,r#   
setdefaultFrozenDict.setdefaultD   s#    =dnn>U>U=VV`abbr%   c                H    \        R V P                  P                   R24      h)zYou cannot use ``pop`` on a r'   r(   r+   s   &*,r#   popFrozenDict.popG   s"    6t~~7N7N6OzZ[[r%   c                H    \        R V P                  P                   R24      h)zYou cannot use ``update`` on a r'   r(   r+   s   &*,r#   updateFrozenDict.updateJ   s#    9$..:Q:Q9RR\]^^r%   c                   < \        V R 4      '       d6   V P                  '       d$   \        RV P                  P                   R24      h\
        SV `  W4       R# __frozenz$You cannot use ``__setattr__`` on a r'   N)hasattrr   r)   r"   r*   r   __setattr__r   namer!   r"   s   &&&r#   r;   FrozenDict.__setattr__M   F    4$$B4>>CZCZB[[efggD(r%   c                   < \        V R 4      '       d6   V P                  '       d$   \        RV P                  P                   R24      h\
        SV `  W4       R# r8   )r:   r   r)   r"   r*   r   __setitem__r<   s   &&&r#   rA   FrozenDict.__setitem__R   r?   r%   )r9   )r*   
__module____qualname____firstlineno__r   r,   r/   r2   r5   r;   rA   __static_attributes____classdictcell____classcell__r"   __classdict__s   @@r#   r   r   8   s1     dc\_)
) )r%   r   c                   v  a  ] tR t^Xt o RtRt. tRt. tRt	]
RR l4       tR tV 3R lR ltRV 3R lR	 llt]
RV 3R
 lR ll4       t]
R 4       t]
]R V 3R lR ll4       4       t]R 4       t]
R 4       t]
R!V 3R lR ll4       tR t]V 3R lR l4       tV 3R lR ltV 3R lR lt]
V 3R lR l4       tRtV tR# )"ConfigMixina  
Base class for all configuration classes. All configuration parameters are stored under `self.config`. Also
provides the [`~ConfigMixin.from_config`] and [`~ConfigMixin.save_config`] methods for loading, downloading, and
saving classes that inherit from [`ConfigMixin`].

Class attributes:
    - **config_name** (`str`) -- A filename under which the config should stored when calling
      [`~ConfigMixin.save_config`] (should be overridden by parent class).
    - **ignore_for_config** (`list[str]`) -- A list of attributes that should not be saved in the config (should be
      overridden by subclass).
    - **has_compatibles** (`bool`) -- Whether the class has compatible classes (should be overridden by subclass).
    - **_deprecated_kwargs** (`list[str]`) -- Keyword arguments that are deprecated. Note that the `init` function
      should only have a `kwargs` argument if at least one argument is deprecated (should be overridden by
      subclass).
NFc                >    VR8w  d   \        RV R24      hWn        R# )a  
Register this class with the given auto class so that it can be loaded with `AutoModel.from_pretrained(...,
trust_remote_code=True)`.

When the config is saved, the resulting `config.json` will include an `auto_map` entry mapping the auto class
to this class's module and class name.

Args:
    auto_class (`str` or type, *optional*, defaults to `"AutoModel"`):
        The auto class to register this class with. Can be a string (e.g. `"AutoModel"`) or the class itself.
        Currently only `"AutoModel"` is supported.

Example:

```python
from diffusers import ModelMixin, ConfigMixin


class MyCustomModel(ModelMixin, ConfigMixin): ...


MyCustomModel.register_for_auto_class("AutoModel")
```
	AutoModelz$Only 'AutoModel' is supported, got ''.N)
ValueError_auto_class)cls
auto_classs   &&r#   register_for_auto_class#ConfigMixin.register_for_auto_classp   s&    4 $CJ<rRSS$r%   c                B   V P                   f   \        RV P                   R24      hVP                  RR 4       \	        V R4      '       g   TpM@\        V P                  4      p/ V P                  CVCp\        P                  RV RV 24       \        V4      V n        R # )NzMake sure that z' has defined a class name `config_name`r   _internal_dictzUpdating config from z to )
config_nameNotImplementedErrorr"   r2   r:   dictrW   loggerdebugr   )r   r   internal_dictprevious_dicts   &,  r#   register_to_configConfigMixin.register_to_config   s    #%7GGn&opp 	

8T"t-.."M !4!45M=t22=f=MLL0tM?ST(7r%   c                &   < V ^8  d   QhRS[ RS[/# )   r=   return)strr   )formatrJ   s   "r#   __annotate__ConfigMixin.__annotate__   s     Z Z Z Zr%   c                   RV P                   9   ;'       d    \        V P                   R,          V4      pWP                   9   pV'       dc   V'       g[   RV R\        V 4      P                   RV R\        V 4      P                   RV R2p\	        RR	VR
R7       V P
                  V,          # \        R\        V 4      P                   RV R24      h)a7  The only reason we overwrite `getattr` here is to gracefully deprecate accessing
config attributes directly. See https://github.com/huggingface/diffusers/pull/3129

This function is mostly copied from PyTorch's __getattr__ overwrite:
https://pytorch.org/docs/stable/_modules/torch/nn/modules/module.html#Module
rW   zAccessing config attribute `z` directly via 'z1' object attribute is deprecated. Please access 'z' over 'z1's config object instead, e.g. 'scheduler.config.rO   zdirect config name access1.0.0Fstandard_warn'z' object has no attribute ')__dict__r:   typer*   r   rW   AttributeError)r   r=   is_in_configis_attributedeprecation_messages   &&   r#   __getattr__ConfigMixin.__getattr__   s    (4==8kkWT]]ScEdfj=k}},$@FVW[\`WaWjWjVk  l]  ^b  ]c  ck  lp  qu  lv  l  l  k@  @q  rv  qw  wy  #z17<O_de&&t,,qd!4!4 55PQUPVVWXYYr%   c                J   < V ^8  d   QhRS[ S[P                  ,          RS[/# )rb   save_directorypush_to_hub)rd   osPathLikebool)re   rJ   s   "r#   rf   rg      s$     * *#*; *$ *r%   c           	        \         P                  P                  V4      '       d   \        RV R24      h\         P                  ! VRR7       \         P                  P                  WP                  4      pV P                  V4       \        P                  RV 24       V'       d   VP                  RR4      pVP                  RR4      pVP                  R	R
4      pVP                  RR4      pVP                  RVP                  \         P                  P                  4      R,          4      p	\        V	RWhR7      P                  p	VP                  RR4      p
V P                  VV	VVVV
R7       R# R# )a  
Save a configuration object to the directory specified in `save_directory` so that it can be reloaded using the
[`~ConfigMixin.from_config`] class method.

Args:
    save_directory (`str` or `os.PathLike`):
        Directory where the configuration JSON file is saved (will be created if it does not exist).
    push_to_hub (`bool`, *optional*, defaults to `False`):
        Whether or not to push your model to the Hugging Face Hub after saving it. You can specify the
        repository you want to push to with `repo_id` (will default to the name of `save_directory` in your
        namespace).
    kwargs (`dict[str, Any]`, *optional*):
        Additional keyword arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method.
zProvided path (z#) should be a directory, not a fileT)exist_okzConfiguration saved in commit_messageNprivate	create_prFtokenrepo_id)r|   r~   r   	subfolder)r   r}   r   r   )rx   pathisfileAssertionErrormakedirsjoinrX   to_json_filer[   infor2   splitsepr   r   _upload_folder)r   rv   rw   r   output_config_filer}   r~   r   r   r   r   s   &&&,       r#   save_configConfigMixin.save_config   s5    77>>.)) ?>2BBe!fgg
NT2  WW\\.:J:JK,--.@-ABC#ZZ(8$?NjjD1G

;6IJJw-EjjN,@,@,Mb,QRG!'D'W__G

;5I-##    r%   c          	         < V ^8  d   QhRS[ S[S[S[3,          ,          RS[S[S[S[S[S[3,          3,          ,          /# )rb   configrc   )r   rZ   rd   r   r   tuple)re   rJ   s   "r#   rf   rg      sE     Y Y$sCx.0Y	dDcN*+	+Yr%   c                   RV9   d   VP                  R4      pVf   \        R4      h\        V\        4      '       gj   RpRV P                  9   d   VRV  R2,          pM!RV P                  9   d   VRV  R	V  R
2,          p\        RRVRR7       V P                  ! RRVRR/VB w  rV P                  ! V3/ VB w  rVpRV9   d   VP                  R4      VR&   V P                   F  pW9   g   K  VP                  V4      WX&   K   	  V ! R/ VB p	RV9   d   V P                  VR&   V	P                  ! R/ VB  / VCVCpV'       d   W3# V	# )aB  
Instantiate a Python class from a config dictionary.

Parameters:
    config (`dict[str, Any]`):
        A config dictionary from which the Python class is instantiated. Make sure to only load configuration
        files of compatible classes.
    return_unused_kwargs (`bool`, *optional*, defaults to `False`):
        Whether kwargs that are not consumed by the Python class should be returned or not.
    kwargs (remaining dictionary of keyword arguments, *optional*):
        Can be used to update the configuration object (after it is loaded) and initiate the Python class.
        `**kwargs` are passed directly to the underlying scheduler/model's `__init__` method and eventually
        overwrite the same named arguments in `config`.

Returns:
    [`ModelMixin`] or [`SchedulerMixin`]:
        A model or scheduler object instantiated from a config dictionary.

Examples:

```python
>>> from diffusers import DDPMScheduler, DDIMScheduler, PNDMScheduler

>>> # Download scheduler from huggingface.co and cache.
>>> scheduler = DDPMScheduler.from_pretrained("google/ddpm-cifar10-32")

>>> # Instantiate DDIM scheduler class with same config as DDPM
>>> scheduler = DDIMScheduler.from_config(scheduler.config)

>>> # Instantiate PNDM scheduler class with same config as DDPM
>>> scheduler = PNDMScheduler.from_config(scheduler.config)
```
pretrained_model_name_or_pathzFPlease make sure to provide a config as the first positional argument.zJIt is deprecated to pass a pretrained model name or path to `from_config`.	Schedulerz3If you were trying to load a scheduler, please use z.from_pretrained(...) instead. Otherwise, please make sure to pass a configuration dictionary instead. This functionality will be removed in v1.0.0.Modelz/If you were trying to load a model, please use z.load_config(...) followed by z.from_config(...) instead. Otherwise, please make sure to pass a configuration dictionary instead. This functionality will be removed in v1.0.0.zconfig-passed-as-pathri   Frj   return_unused_kwargsTdtype_class_name )
r2   rP   
isinstancerZ   r*   r   load_configextract_init_dict_deprecated_kwargsr_   )
rR   r   r   r   rr   	init_dictunused_kwargshidden_dictdeprecated_kwargmodels
   &&&,      r#   from_configConfigMixin.from_config   s   N +f4ZZ ?@F>eff &$''"ncll*#I# O- -#
 CLL(#EcU Ku NN#
 -w8K[`a __w6whlwpvwNF030E0Ef0WPV0W-	+ m#!.!2!27!;Ig !$ 6 60.;.?.?@P.Q	+ !7
  i  K'),K&  /;/ 9=8K8))Lr%   c                P    R V  R2p\        RRVRR7       V P                  ! V/ VB # )z8 The function get_config_dict is deprecated. Please use zE.load_config instead. This function will be removed in version v1.0.0get_config_dictri   Frj   )r   r   )rR   r   r   rr   s   &*, r#   r   ConfigMixin.get_config_dict:  sC     Gse L) ) 	 	#W.AQVW///r%   c                   < V ^8  d   QhRS[ S[P                  ,          RS[S[S[ S[3,          S[S[ S[3,          3,          /# )rb   r   rc   )rd   rx   ry   r   rZ   r   )re   rJ   s   "r#   rf   rg   E  sF     g g'*R[['8g 
tCH~tCH~-	.gr%   c                (   VP                  RR4      pVP                  RR4      pVP                  RR4      pVP                  RR4      pVP                  RR4      p	VP                  R	R4      p
VP                  R
R4      pVP                  RR4      pVP                  RR4      pVP                  RR4      pVP                  R/ 4      pVP                  RR4      p/ VCRR/Cp\        V4      p\        V4      pV P                  f   \	        R4      hV'       d$   Ve   \	        R4      hV P                  VV4      pEM\        P                  P                  V4      '       d   TpEMV\        P                  P                  V4      '       Ed   Vey   \        P                  P                  \        P                  P                  WV P                  4      4      '       d,   \        P                  P                  WV P                  4      pM\        P                  P                  \        P                  P                  WP                  4      4      '       d+   \        P                  P                  WP                  4      pM>\        RV P                   RV R24      h \        VV P                  VVV	VV
VVVVVR7      p V P%                  VVR&7      p\'        V4      pT'       g   T'       g   T# T3pT'       d   TT3,          pT'       d   TT3,          pT#   \         d    \        T R24      h\         d    \        T RT R24      h\         d    \        T RT P                   R24      h\          d   p\        RT RT 24      hRp?i\         d%    \        R\"         RT R T P                   R!24      h\         d!    \        R"T R#T R$T P                   R%24      hi ; i  \(        P*                  \,        3 d    \        R'T R(24      hi ; i))ag	  
Load a model or scheduler configuration.

Parameters:
    pretrained_model_name_or_path (`str` or `os.PathLike`, *optional*):
        Can be either:

            - A string, the *model id* (for example `google/ddpm-celebahq-256`) of a pretrained model hosted on
              the Hub.
            - A path to a *directory* (for example `./my_model_directory`) containing model weights saved with
              [`~ConfigMixin.save_config`].

    cache_dir (`str | os.PathLike`, *optional*):
        Path to a directory where a downloaded pretrained model configuration is cached if the standard cache
        is not used.
    force_download (`bool`, *optional*, defaults to `False`):
        Whether or not to force the (re-)download of the model weights and configuration files, overriding the
        cached versions if they exist.
    proxies (`dict[str, str]`, *optional*):
        A dictionary of proxy servers to use by protocol or endpoint, for example, `{'http': 'foo.bar:3128',
        'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request.
    output_loading_info(`bool`, *optional*, defaults to `False`):
        Whether or not to also return a dictionary containing missing keys, unexpected keys and error messages.
    local_files_only (`bool`, *optional*, defaults to `False`):
        Whether to only load local model weights and configuration files or not. If set to `True`, the model
        won't be downloaded from the Hub.
    token (`str` or *bool*, *optional*):
        The token to use as HTTP bearer authorization for remote files. If `True`, the token generated from
        `diffusers-cli login` (stored in `~/.huggingface`) is used.
    revision (`str`, *optional*, defaults to `"main"`):
        The specific model version to use. It can be a branch name, a tag name, a commit id, or any identifier
        allowed by Git.
    subfolder (`str`, *optional*, defaults to `""`):
        The subfolder location of a model file within a larger model repository on the Hub or locally.
    return_unused_kwargs (`bool`, *optional*, defaults to `False):
        Whether unused keyword arguments of the config are returned.
    return_commit_hash (`bool`, *optional*, defaults to `False):
        Whether the `commit_hash` of the loaded configuration are returned.

Returns:
    `dict`:
        A dictionary of all the parameters stored in a JSON configuration file.

	cache_dirN	local_dirlocal_dir_use_symlinksautoforce_downloadFproxiesr   local_files_onlyrevisionmirrorr   
user_agentdduf_entries	file_typer   z`self.config_name` is not defined. Note that one should not load a config from `ConfigMixin`. Please make sure to define `config_name` in a class inheriting from `ConfigMixin`zDDUF file only allow for 1 level of directory (e.g transformer/model1/model.safetentors is not allowed). Please check the DDUF structurezError no file named z found in directory .)filenamer   r   r   r   r   r   r   r   r   r   z is not a local folder and is not a valid model identifier listed on 'https://huggingface.co/models'
If this is a private repository, make sure to pass a token having permission to this repo with `token` or log in with `hf auth login`.z is not a valid git identifier (branch name, tag name or commit id) that exists for this model name. Check the model page at 'https://huggingface.co/z' for available revisions.z& does not appear to have a file named z:There was a specific connection error when trying to load z:
zWe couldn't connect to 'zM' to load this model, couldn't find it in the cached files and it looks like z- is not the path to a directory containing a z file.
Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/diffusers/installation#offline-mode'.zCan't load config for 'z'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'z2' is the correct path to a directory containing a z file)r   z"It looks like the config file at 'z' is not a valid JSON file.)r2   r   rd   rX   rP   _get_config_file_from_ddufrx   r   r   isdirr   EnvironmentErrorr   r
   r   r   r	   r   _dict_from_json_filer   jsonJSONDecodeErrorUnicodeDecodeError)rR   r   r   return_commit_hashr   r   r   r   r   r   r   r   r   _r   r   r   config_fileerrconfig_dictcommit_hashoutputss   &&&&,                 r#   r   ConfigMixin.load_configC  s8   j JJ{D1	JJ{D1	!',Df!M$4e<**Y-

7D)!::&8%@::j$/JJx&JJ{D1	ZZb1
4:JJ~t4T:
:K:
$Z0
(+,I(J%??"s 
 $ 6  889VXdeKWW^^9::7KWW]]899$:sW* * !ggll+HUXUdUde-JOO \]] ggll+H//Z&*3??*;;OPmOnnop 3-1 __'#1#%5)'%'+Ad	r22;\2ZK-k:K %(:.y G~%Gm + &45 6i i 
 ) &j !00M/NNhj 
 & &455[\_\k\k[llmn  " &56c#@   &./N.O P>>[=\ ]//2.? @ZZ  $ &-.K-L M--J,K L$$'OO#4E;  $$&89 	r"%G}To#pqq	rsB   !L ;O& !O#6O#$O#6O#7NO#,O#!O#&+Pc                    \        \        \        P                  ! V P                  4      P
                  4      P                  4       4      # N)setrZ   inspect	signaturer   
parameterskeys)input_classs   &r#   _get_init_keysConfigMixin._get_init_keys  s2    4))+*>*>?JJKPPRSSr%   c           	     4	   VP                  R . 4      pVP                  4        UUu/ uF  w  rEWC9  g   K  VR 8w  g   K  WEbK  	  ppp\        VP                  4       4      pV P                  V 4      pVP	                  R4       RV9   d   VP	                  R4       \        V R4      '       d%   V P                   F  pVP	                  V4       K  	  \        V P                  4      ^ 8  d   V\        V P                  4      ,
          p\        P                  ! \        P                  R4      ^ ,          4      p	V P                  '       d9   V P                  4        U
u. uF  p
\!        V
\"        4      '       d   K  V
NK  	  pp
M. p\        4       pV F%  p
V P                  V
4      pVP%                  V4      pK'  	  WP                  V 4      ,
          pVP                  4        UUu/ uF  w  rEWL9  g   K  WEbK  	  pppVP'                  RV P                  4      p\!        V\(        4      '       dr   WP                  8w  db   \        W4      '       dQ   \+        W4      pV P                  V4      V,
          pVP                  4        UUu/ uF  w  rEVV9  g   K  WEbK  	  pppM=\!        V\(        4      '       g(   \!        V\,        \.        34      '       g   \1        R4      hVP                  4        UUu/ uF   w  rEVP3                  R4      '       d   K  WEbK"  	  pppVP                  4        UUu/ uF  w  rEVR8w  g   K  WEbK  	  ppp/ pV F_  pVV9   d   VV9   d   VP'                  V4      VV&   VV9   d   VP'                  V4      VV&   KB  VV9   g   KK  VP'                  V4      VV&   Ka  	  \        V4      ^ 8  d4   \4        P7                  R	V R
V P                   RV P8                   R24       \        VP;                  4       4      p\        VV,
          4      ^ 8  d    \4        P=                  VV,
           R24       / VCVCpVP                  4        UUu/ uF  w  rEVV9  g   K  WEbK  	  pppVVV3# u uppi u up
i u uppi u uppi u uppi u uppi u uppi )_use_default_valuesr   r   _flax_internal_argsr   r   z\Make sure that the `_class_name` is of type string or list of string (for custom pipelines).r   quantization_configzThe config attributes z were passed to z?, but are not expected and will be ignored. Please verify your z configuration file.zG was not found in config. Values will be initialized to default values.)getr   rZ   r   remover:   r   lenignore_for_configr   	importlibimport_moduler*   r   has_compatibles_get_compatiblesr   r   unionr2   rd   getattrlistr   rP   
startswithr[   warningrX   r   r   )rR   r   r   used_defaultskvoriginal_dictexpected_keysargdiffusers_libraryccompatible_classesexpected_keys_comp_clsexpected_keys_corig_cls_nameorig_clsunexpected_keys_from_origr   r    passed_keysr   hidden_config_dicts   &&,                   r#   r   ConfigMixin.extract_init_dict  sD    $(=rB(3(9(9(;u(;q?UtZ[_tZttqt(;u [..01 **3/V$}$  *3-....$$S) /
 s$$%))C0E0E,FFM &33HNN34G4JK-0-A-A-C!f-C:VWYdKe!!-C!f!#!$#A!003O%;%A%A/%R" $ "8:L:LS:Q!Q(3(9(9(;_(;q?^tqt(;_ $s||D}c**-)990@H(+(:(:8(D}(T%,7,=,=,?f,?DA1LeCe414,?KfKM3//
=SWY^R_8`8`n 
 )4(9(9(;U(;1<<PSCTtqt(;U )4(9(9(;Z(;qDY?Ytqt(;Z 	 C f}!3#)::c?C f}!'C	##!,!5	# ! {aNN(5Ecll^ TP??##79 )..*+}{*+a/KK ;.//vw
 2;1&1 0=/B/B/D[/DtqQZHZdad/D[-);;;{ v2 "g ` g V [H \sW   
Q1Q1Q1Q77Q7!
Q<0Q<RR,RR(R8RR#Rc                n   < V ^8  d   QhRS[ S[P                  ,          RS[S[ S[3,          R,          /# )rb   	json_filer   N)rd   rx   ry   rZ   r   )re   rJ   s   "r#   rf   rg   V  s6        S2;;->  dSVXaSaNbeiNi  r%   c                    V'       d   W!,          P                  4       pM/\        VR RR7      ;_uu_ 4       pVP                  4       pRRR4       \        P                  ! X4      #   + '       g   i     L&; i)rutf-8encodingN)	read_textopenreadr   loads)rR   r   r   textreaders   &&&  r#   r    ConfigMixin._dict_from_json_fileU  sO    *446Diw776{{} 8zz$ 87s   A%%A5	c                T    V P                   P                   R V P                  4        2# ) )r"   r*   to_json_stringr   s   &r#   __repr__ConfigMixin.__repr__^  s(    ..))*!D,?,?,A+BCCr%   c                6   < V ^8  d   QhRS[ S[S[3,          /# rb   rc   )rZ   rd   r   )re   rJ   s   "r#   rf   rg   b  s     # #S#X #r%   c                    V P                   # )zm
Returns the config of the class as a frozen dictionary

Returns:
    `dict[str, Any]`: Config of the class.
rW   r  s   &r#   r   ConfigMixin.configa  s     """r%   c                    < V ^8  d   QhRS[ /# r
  )rd   )re   rJ   s   "r#   rf   rg   k  s     +H +H +Hr%   c                0  a \        V R4      '       d   V P                  M/ pV P                  P                  VR&   \        VR&   V3R loRV9   dJ   \        VP                  \        4      '       g   VP                  P                  4       MVP                  VR&   VP                  4        UUu/ uF  w  r#VS! V4      bK  	  pppVP                  RR4       VP                  RR4       VP                  R	R4      p\        V R
R4      ej   V P                  P                  P                  R4      R,          pVP                  R/ 4      pV RV P                  P                   2W`P                  &   WaR&   \         P"                  ! V^RR7      R,           # u uppi )z
Serializes the configuration instance to a JSON string.

Returns:
    `str`:
        String containing all the attributes that make up the configuration instance in JSON format.
rW   r   _diffusers_versionc                   < \        V \        P                  4      '       d   V P                  4       p V # \        V \        4      '       d   V P                  4       p V # \        V R 4      '       d.   \        V P                  4      '       d   V P                  4       p V # \        V \        4      '       d   V  Uu. uF  pS! V4      NK  	  p pV # u upi )to_dict)
r   npndarraytolistr   as_posixr:   callabler  r   )r!   r   to_json_saveables   & r#   r  4ConfigMixin.to_json_string.<locals>.to_json_saveablew  s    %,, L E4(((
 L	 	**x/F/F L E4((6;<e)!,e<L =s   5C
r   _ignore_filesNr   _pre_quantization_dtyperQ   r   auto_mapT)indent	sort_keys
r   )r:   rW   r"   r*   r   r   r   rZ   r  r   r2   r   rC   r   r   rQ   r   dumps)r   r   r   r   r   moduler  r  s   &      @r#   r  ConfigMixin.to_json_stringk  sp    .5T;K-L-Ld))RT%)^^%<%<M",7()		 !K/ "+"A"A4HH //779 44 -. ;F:K:K:MN:M$!q*1--:MN.-t4OO5t<4-9^^..44S9"=F"z26H,281T^^5L5L4M)NH%%&&.
#zz+a4@4GG Os   -Fc                D   < V ^8  d   QhRS[ S[P                  ,          /# )rb   json_file_path)rd   rx   ry   )re   rJ   s   "r#   rf   rg     s     	0 	03+< 	0r%   c                    \        VRRR7      ;_uu_ 4       pVP                  V P                  4       4       RRR4       R#   + '       g   i     R# ; i)z
Save the configuration instance's parameters to a JSON file.

Args:
    json_file_path (`str` or `os.PathLike`):
        Path to the JSON file to save a configuration instance's parameters.
wr   r   N)r   writer  )r   r$  writers   && r#   r   ConfigMixin.to_json_file  s9     .#88FLL,,./ 9888s    AA	c                <   < V ^8  d   QhRS[ RS[S[ S[3,          /# )rb   r   r   )rd   rZ   r   )re   rJ   s   "r#   rf   rg     s(      s Z^_bdm_mZn r%   c                    VR 8X  d   V P                   MRP                  WP                   .4      pW29  d    \        RV RVP                  4        24      hV# ) /z#We did not manage to find the file z4 in the dduf file. We only have the following files )rX   r   rP   r   )rR   r   r   r   s   &&& r#   r   &ConfigMixin._get_config_file_from_dduf  s~    
 -2 OO8//JK 	
 *5k]Bv  xD  xI  xI  xK  wL  M  r%   r  )rN   )FNF)FFr   )r*   rC   rD   rE   __doc__rX   r   r   r   rQ   classmethodrT   r_   rs   r   r   r   r   r   staticmethodr   r   r   r  propertyr   r  r   r   rF   rG   )rJ   s   @r#   rL   rL   X   s6      KOK% %<8"Z Z$* *X Y Y Yv 0 0 g g  gR T T `< `<D      D # #+H +HZ	0 	0  r%   rL   c                F   a  \         P                  ! S 4      V 3R l4       pV# )a  
Decorator to apply on the init of classes inheriting from [`ConfigMixin`] so that all the arguments are
automatically sent to `self.register_for_config`. To ignore a specific argument accepted by the init but that
shouldn't be registered in the config, use the `ignore_for_config` class variable

Warning: Once decorated, all private arguments (beginning with an underscore) are trashed and not sent to the init!
c                   < VP                  4        UUu/ uF   w  r4VP                  R 4      '       d   K  W4bK"  	  pppVP                  4        UUu/ uF   w  r4VP                  R 4      '       g   K  W4bK"  	  ppp\        V \        4      '       g$   \	        RV P
                  P                   R24      h\        V R. 4      p/ p\        P                  ! S4      p	\        V	P                  P                  4       4       U
UUu/ uF%  w  p
w  rV
^ 8  g   K  W9  g   K  WP                  bK'  	  ppp
p\        WP                  4       4       F	  w  rWV&   K  	  TP                  VP                  4        UUu/ uF&  w  r?W79  g   K  W89  g   K  W5P!                  W?4      bK(  	  upp4       \#        \%        VP                  4       4      \%        V4      ,
          4      ^ 8  d6   \'        \%        VP                  4       4      \%        V4      ,
          4      VR&   / VCVCp\        V R4      ! R/ VB  S! V .VO5/ VB  R# u uppi u uppi u uppp
i u uppi )r   &`@register_for_config` was applied to A init method, but this class does not inherit from `ConfigMixin`.r   r   r_   Nr   )r   r   r   rL   RuntimeErrorr"   r*   r   r   r   	enumerater   defaultzipr   r5   r   r   r   r   )r   r   r   r   r   init_kwargsconfig_init_kwargsignore
new_kwargsr   ir=   pr   r   r:  inits   &*,             r#   
inner_init&register_to_config.<locals>.inner_init  s    )/Pall3>OtqtP/5||~S~tqcARdad~S$,,89P9P8Q R2 2 
 2B7
%%d+	09):N:N:T:T:V0W
0W9D[\_`[`OeiewOD))O0W 	 
 T??#45IC"t 6 	 #-"2"2"4"4JA? /'(': /??1.."4	
 s:??$%K(889A=04S9J5KcR]N^5^0_J,-9*9j9
*+9j9T(D(K(C QS
s:   H8H8H>1H>?III2
I
I
	I
)	functoolswraps)rB  rC  s   f r#   r_   r_     s)     __T#) #)J r%   c                 j   a V P                   o\        P                  ! S4      V3R  l4       pWn         V # )c                 ~  < \        V \        4      '       g$   \        R V P                  P                   R24      h\        VP                  4       4      p\        P                  ! V 4      p/ pV Fy  pVP                  V P                  9   d   K   \        VP                  4      \        P                  8X  d   RWVP                  &   KX  \        WP                  4      WVP                  &   K{  	  / VCVCpRV9   d   VP                  R4       \!        V4       F  w  rWH,          P                  p
WV
&   K  	  \#        \%        VP'                  4       4      \%        V4      ,
          4      ^ 8  d6   \)        \%        VP'                  4       4      \%        V4      ,
          4      VR&   \        V R4      ! R/ VB  S! V .VO5/ VB  R# )r6  r7  Nr   r   r_   r   )r   rL   r8  r"   r*   rZ   r   dataclassesfieldsr=   r   rn   r:  _MISSING_TYPEr   r2   r9  r   r   r   r   )r   r   r   r<  rJ  default_kwargsfieldr?  r@  r   r=   original_inits   &*,        r#   rB  %flax_register_to_config.<locals>.init  su   $,,89P9P8Q R2 2  6<<>* ##D)EzzT555EMM"k&?&??-1zz*-4T::-Fzz*  76+6
j NN7#  oFA9>>D"t &
 s:??$%K(889A=04S9J5KcR]N^5^0_J,-*+9j9d,T,V,r%   )r   rE  rF  )rR   rB  rN  s   & @r#   flax_register_to_configrP    s4    LLM__]#&- $&-P LJr%   c                   P   a a ] tR tRt oRt]RV3R lV 3R lll4       tRtVtV ;t	# )LegacyConfigMixini  z
A subclass of `ConfigMixin` to resolve class mapping from legacy classes (like `Transformer2DModel`) to more
pipeline-specific classes (like `DiTTransformer2DModel`).
c                F   < V ^8  d   QhRS[ S[S[S[3,          ,          /# )rb   r   )r   rZ   rd   r   )re   rJ   s   "r#   rf   LegacyConfigMixin.__annotate__  s$     
V 
Vd38n!< 
Vr%   c                z   < ^RI Hp V! W4      pWPJ d   \        \        V`  ! W3/ VB # VP                  ! W3/ VB # )   )_fetch_remapped_cls_from_config)models.model_loading_utilsrW  r   rR  r   )rR   r   r   r   rW  remapped_classr"   s   &&&,  r#   r   LegacyConfigMixin.from_config  sJ     	P 9E *NGohnoo!--fUfUUr%   r   r/  )
r*   rC   rD   rE   r0  r1  r   rF   rG   rH   rI   s   @@r#   rR  rR    s,     
 
V 
V 
V 
Vr%   rR  )/r0  rI  rE  r   r   r   rx   recollectionsr   pathlibr   typingr   numpyr  huggingface_hubr   r   r   huggingface_hub.utilsr   r	   r
   r   r   typing_extensionsr   r,  r   utilsr   r   r   r   r   r   
get_loggerr*   r[   compile_re_configuration_filer   rL   r_   rP  rR  r   r%   r#   <module>rg     s     ,      	 	 #    C C  #   
		H	%$9: ) )@W	 W	t/d-`V Vr%   