
    +h!                         S SK r S SKrS SKJr  S SKJr  S SKJrJr  S SK	r	S SK
Jr  S SKJr  SSKJrJr  S	r " S
 S\5      r/ SQ/ SQ/ SQ/ SQ/ SQS.r\ " S S\5      5       r " S S\5      rg)    N)	dataclass)Enum)OptionalUnion)validate_hf_hub_args)Self   )
BaseOutputPushToHubMixinzscheduler_config.jsonc                   P    \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rSrSrSrSrSrSrSrg)KarrasDiffusionSchedulers"      r	                     	   
                   N)__name__
__module____qualname____firstlineno__DDIMSchedulerDDPMSchedulerPNDMSchedulerLMSDiscreteSchedulerEulerDiscreteSchedulerHeunDiscreteSchedulerEulerAncestralDiscreteSchedulerDPMSolverMultistepSchedulerDPMSolverSinglestepSchedulerKDPM2DiscreteSchedulerKDPM2AncestralDiscreteSchedulerDEISMultistepSchedulerUniPCMultistepSchedulerDPMSolverSDESchedulerEDMEulerScheduler__static_attributes__r       _/home/james-whalen/.local/lib/python3.13/site-packages/diffusers/schedulers/scheduling_utils.pyr   r   "   sY    MMM&'#"##$ &(# r2   r   )
  iR  i  i  i!  i  iW     |      ){G:-@gfffff@gS@g~jt@gV-?gtV?g7A`?gw/?gK7?g~jt?        )
r4   iM  i  iK  i  i6     t   5   r   )r8   g(\B@g^I+@g r@gFx?g/$?g(\?gRQ?gʡE?g!rh?r9   )g     @g     @K@gʡ/@g r@gˡE@g9v?g1Zd?gn?g/$?g rh?r9   )StableDiffusionTimestepsStableDiffusionSigmasStableDiffusionXLTimestepsStableDiffusionXLSigmasStableDiffusionVideoSigmasc                   8    \ rS rSr% Sr\R                  \S'   Srg)SchedulerOutput=   a0  
Base class for the output of a scheduler's `step` function.

Args:
    prev_sample (`torch.Tensor` of shape `(batch_size, num_channels, height, width)` for images):
        Computed sample `(x_{t-1})` of previous timestep. `prev_sample` should be used as next model input in the
        denoising loop.
prev_sampler   N)	r   r   r    r!   __doc__torchTensor__annotations__r1   r   r2   r3   rC   rC   =   s     r2   rC   c            	           \ rS rSrSr\r/ rSr\	\
   SS\\\\R                  4      S\\   S\4S jj5       5       rSS	\\\R                  4   S
\4S jjr\S 5       r\	S 5       rSrg)SchedulerMixinK   a  
Base class for all schedulers.

[`SchedulerMixin`] contains common functions shared by all schedulers such as general loading and saving
functionalities.

[`ConfigMixin`] takes care of storing the configuration attributes (like `num_train_timesteps`) that are passed to
the scheduler's `__init__` function, and the attributes can be accessed by `scheduler.config.num_train_timesteps`.

Class attributes:
    - **_compatibles** (`List[str]`) -- A list of scheduler classes that are compatible with the parent scheduler
      class. Use [`~ConfigMixin.from_config`] to load a different compatible scheduler class (should be overridden
      by parent class).
TNpretrained_model_name_or_path	subfolderreturnc                 `    U R                   " SUUSSS.UD6u  pTnU R                  " U4SU0UD6$ )a
  
Instantiate a scheduler from a pre-defined JSON configuration file in a local directory or Hub repository.

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 the scheduler
              configuration saved with [`~SchedulerMixin.save_pretrained`].
    subfolder (`str`, *optional*):
        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 kwargs that are not consumed by the Python class should be returned or not.
    cache_dir (`Union[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.

<Tip>

To use private or [gated models](https://huggingface.co/docs/hub/models-gated#gated-models), log-in with `hf
auth login`. You can also activate the special
["offline-mode"](https://huggingface.co/diffusers/installation.html#offline-mode) to use this method in a
firewalled environment.

</Tip>

T)rM   rN   return_unused_kwargsreturn_commit_hashrQ   r   )load_configfrom_config)clsrM   rN   rQ   kwargsconfigcommit_hashs          r3   from_pretrainedSchedulerMixin.from_pretrained_   sP    p '*oo '
*G!%#	'

 '
# v[<P[TZ[[r2   save_directorypush_to_hubc                 ,    U R                   " SXS.UD6  g)a  
Save a scheduler configuration object to a directory so that it can be reloaded using the
[`~SchedulerMixin.from_pretrained`] class method.

Args:
    save_directory (`str` or `os.PathLike`):
        Directory where the configuration JSON file will be 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.
)r[   r\   Nr   )save_config)selfr[   r\   rV   s       r3   save_pretrainedSchedulerMixin.save_pretrained   s     	ZZSYZr2   c                 "    U R                  5       $ )z
Returns all schedulers that are compatible with this scheduler

Returns:
    `List[SchedulerMixin]`: List of compatible schedulers
)_get_compatibles)r_   s    r3   compatiblesSchedulerMixin.compatibles   s     $$&&r2   c                    [        [        U R                  /U R                  -   5      5      n[        R
                  " [        R                  S5      S   5      nU Vs/ s H   n[        X#5      (       d  M  [        X#5      PM"     nnU$ s  snf )N.r   )	listsetr   _compatibles	importlibimport_modulesplithasattrgetattr)rU   compatible_classes_strdiffusers_libraryccompatible_classess        r3   rc   SchedulerMixin._get_compatibles   s}    !%c3<<.3;K;K*K&L!M%33HNN34G4JK3I
3IaWUfMj)G%)3I 	 
 "!
s   B5Br   )NNF)F)r   r   r    r!   rF   SCHEDULER_CONFIG_NAMEconfig_namerj   has_compatiblesclassmethodr   r   r   strosPathLiker   rY   boolr`   propertyrd   rc   r1   r   r2   r3   rK   rK   K   s     (KLO LP#'"	=\'/c2;;6F0G'H=\ C==\ 
=\  =\~[eC4D.E [TX [" ' ' " "r2   rK   )rk   rz   dataclassesr   enumr   typingr   r   rG   huggingface_hub.utilsr   typing_extensionsr   utilsr
   r   ru   r   AysSchedulesrC   rK   r   r2   r3   <module>r      sx     	 !  "  6 " . 0  & !Ri"Rk"n 
j 
 
w"^ w"r2   