§
    ‘M§j~   ã                   óÈ   — d dl Z d dlZd dlmZmZmZmZ d dlZd dl	Z	d dl
mZmZ d dlmZmZmZ d dlmZmZ d dlmZ  e¦   «         r	 d„ Z	 	 	 	 dd„Z G d	„ d
ee¦  «        ZdS )é    N)ÚListÚOptionalÚTupleÚUnion)ÚConfigMixinÚregister_to_config)ÚKarrasDiffusionSchedulersÚSchedulerMixinÚSchedulerOutput)Ú	deprecateÚis_scipy_available)Úrandn_tensorc                 ój   — t          j        dd| dz   ¦  «        d | …         }||z  d|dz
  |z  z   z  }|S ©Né   r   )ÚnpÚlinspace)Úsampling_stepsÚshiftÚsigmas      ú?C:\Users\johnn\OneDrive\Documents\AI\shared\utils\fm_solvers.pyÚget_sampling_sigmasr      sD   € ÝŒK˜˜1˜n¨qÑ0Ñ1Ô1°/°>°/ÔB€EØ�U‰]˜a 5¨1¡9°Ñ"5Ñ5Ñ6€Eà€Ló    c                 óf  — |�|�t          d¦  «        ‚|�€dt          t          j        | j        ¦  «        j                             ¦   «         ¦  «        v }|st          d| j        › d�¦  «        ‚ | j        d
||dœ|¤Ž | j        }t          |¦  «        }n™|�€dt          t          j        | j        ¦  «        j                             ¦   «         ¦  «        v }|st          d| j        › d�¦  «        ‚ | j        d
||dœ|¤Ž | j        }t          |¦  «        }n | j        |fd	|i|¤Ž | j        }||fS )NzYOnly one of `timesteps` or `sigmas` can be passed. Please choose one to set custom valuesÚ	timestepszThe current scheduler class zx's `set_timesteps` does not support custom timestep schedules. Please check whether you are using the correct scheduler.)r   ÚdeviceÚsigmaszv's `set_timesteps` does not support custom sigmas schedules. Please check whether you are using the correct scheduler.)r   r   r   © )
Ú
ValueErrorÚsetÚinspectÚ	signatureÚset_timestepsÚ
parametersÚkeysÚ	__class__r   Úlen)Ú	schedulerÚnum_inference_stepsr   r   r   ÚkwargsÚaccepts_timestepsÚaccept_sigmass           r   Úretrieve_timestepsr-      sº  € ð Ð Ð!3ÝØgñ
ô 
ð 	
ð ÐØ'­3ÝÔ˜iÔ5Ñ6Ô6ÔA×FÒFÑHÔHñ,Jô ,Jð JÐà ð 	Ýðb¨yÔ/Bð bð bð bñô ð ð 	 ˆ	ÔÐM¨)¸FÐMÐMÀfÐMÐMÐMØÔ'ˆ	Ý! )™nœnÐÐØ	Ð	Ø ¥CÝÔ˜iÔ5Ñ6Ô6ÔA×FÒFÑHÔHñ%Jô %Jð Jˆàð 	Ýð`¨yÔ/Bð `ð `ð `ñô ð ð 	 ˆ	ÔÐG v°fÐGÐGÀÐGÐGÐGØÔ'ˆ	Ý! )™nœnÐÐàˆ	ÔÐ 3ÐMÐM¸FÐMÀfÐMÐMÐMØÔ'ˆ	ØÐ)Ð)Ð)r   c                    ó*  — e Zd ZdZd„ eD ¦   «         ZdZeddddddd	dd
dddd ed¦  «         ddfde	de	de
dee         dededede
de
dededee
         dedee
         defd„¦   «         Zed „ ¦   «         Zed!„ ¦   «         ZdFd#e	fd$„Z	 	 	 	 	 dGd%ee	df         d&ee
ej        f         d'eee                  d(eeedf                  deeedf                  f
d)„Zd*ej        d+ej        fd,„Zd-„ Zd.„ Zd(ed/ed0ej        fd1„Zdd2œd3ej        d*ej        d+ej        fd4„Zddd5œd3ej        d*ej        d6eej                 d+ej        fd7„Zddd5œd8eej                 d*ej        d6eej                 d+ej        fd9„Zdd2œd8eej                 d*ej        d+ej        fd:„ZdHd;„Z d<„ Z!	 	 	 dId3ej        d=ee	ej        f         d*ej        d>eej                 d?ed+ee"e#f         fd@„Z$d*ej        d+ej        fdA„Z%dBej        d6ej        dCej&        d+ej        fdD„Z'dE„ Z(dS )JÚFlowDPMSolverMultistepSchedulera‹  
    `FlowDPMSolverMultistepScheduler` is a fast dedicated high-order solver for diffusion ODEs.
    This model inherits from [`SchedulerMixin`] and [`ConfigMixin`]. Check the superclass documentation for the generic
    methods the library implements for all schedulers such as loading and saving.
    Args:
        num_train_timesteps (`int`, defaults to 1000):
            The number of diffusion steps to train the model. This determines the resolution of the diffusion process.
        solver_order (`int`, defaults to 2):
            The DPMSolver order which can be `1`, `2`, or `3`. It is recommended to use `solver_order=2` for guided
            sampling, and `solver_order=3` for unconditional sampling. This affects the number of model outputs stored
            and used in multistep updates.
        prediction_type (`str`, defaults to "flow_prediction"):
            Prediction type of the scheduler function; must be `flow_prediction` for this scheduler, which predicts
            the flow of the diffusion process.
        shift (`float`, *optional*, defaults to 1.0):
            A factor used to adjust the sigmas in the noise schedule. It modifies the step sizes during the sampling
            process.
        use_dynamic_shifting (`bool`, defaults to `False`):
            Whether to apply dynamic shifting to the timesteps based on image resolution. If `True`, the shifting is
            applied on the fly.
        thresholding (`bool`, defaults to `False`):
            Whether to use the "dynamic thresholding" method. This method adjusts the predicted sample to prevent
            saturation and improve photorealism.
        dynamic_thresholding_ratio (`float`, defaults to 0.995):
            The ratio for the dynamic thresholding method. Valid only when `thresholding=True`.
        sample_max_value (`float`, defaults to 1.0):
            The threshold value for dynamic thresholding. Valid only when `thresholding=True` and
            `algorithm_type="dpmsolver++"`.
        algorithm_type (`str`, defaults to `dpmsolver++`):
            Algorithm type for the solver; can be `dpmsolver`, `dpmsolver++`, `sde-dpmsolver` or `sde-dpmsolver++`. The
            `dpmsolver` type implements the algorithms in the [DPMSolver](https://huggingface.co/papers/2206.00927)
            paper, and the `dpmsolver++` type implements the algorithms in the
            [DPMSolver++](https://huggingface.co/papers/2211.01095) paper. It is recommended to use `dpmsolver++` or
            `sde-dpmsolver++` with `solver_order=2` for guided sampling like in Stable Diffusion.
        solver_type (`str`, defaults to `midpoint`):
            Solver type for the second-order solver; can be `midpoint` or `heun`. The solver type slightly affects the
            sample quality, especially for a small number of steps. It is recommended to use `midpoint` solvers.
        lower_order_final (`bool`, defaults to `True`):
            Whether to use lower-order solvers in the final steps. Only valid for < 15 inference steps. This can
            stabilize the sampling of DPMSolver for steps < 15, especially for steps <= 10.
        euler_at_final (`bool`, defaults to `False`):
            Whether to use Euler's method in the final step. It is a trade-off between numerical stability and detail
            richness. This can stabilize the sampling of the SDE variant of DPMSolver for small number of inference
            steps, but sometimes may result in blurring.
        final_sigmas_type (`str`, *optional*, defaults to "zero"):
            The final `sigma` value for the noise schedule during the sampling process. If `"sigma_min"`, the final
            sigma is the same as the last sigma in the training schedule. If `zero`, the final sigma is set to 0.
        lambda_min_clipped (`float`, defaults to `-inf`):
            Clipping threshold for the minimum value of `lambda(t)` for numerical stability. This is critical for the
            cosine (`squaredcos_cap_v2`) noise schedule.
        variance_type (`str`, *optional*):
            Set to "learned" or "learned_range" for diffusion models that predict variance. If set, the model's output
            contains the predicted Gaussian variance.
    c                 ó   — g | ]	}|j         ‘Œ
S r   )Úname)Ú.0Úes     r   ú
<listcomp>z*FlowDPMSolverMultistepScheduler.<listcomp>}   s   € Ð>Ð>Ð>˜q�A”FÐ>Ð>Ð>r   r   iè  é   Úflow_predictionç      ð?Fg×£p=
×ï?údpmsolver++ÚmidpointTÚzeroÚinfNÚnum_train_timestepsÚsolver_orderÚprediction_typer   ÚthresholdingÚdynamic_thresholding_ratioÚsample_max_valueÚalgorithm_typeÚsolver_typeÚlower_order_finalÚeuler_at_finalÚfinal_sigmas_typeÚlambda_min_clippedÚvariance_typeÚinvert_sigmasc                 ó\  — |	dv rd|	› d�}t          dd|¦  «         |	dvr6|	dk    r|                      d¬	¦  «         nt          |	› d
| j        › �¦  «        ‚|
dvr4|
dv r|                      d¬¦  «         nt          |
› d
| j        › �¦  «        ‚|	dvr|dk    rt	          d|› d|	› d�¦  «        ‚d | _        t          j        dd|z  |¦  «        d d d…                              ¦   «         }d|z
  }t          j
        |¦  «                             t          j        ¬¦  «        }|s||z  d|dz
  |z  z   z  }|| _        ||z  | _        d g|z  | _        d| _        d | _        d | _        | j        d                              ¦   «         | _        | j        d                              ¦   «         | _        d S )N©Ú	dpmsolverúsde-dpmsolverzalgorithm_type zn is deprecated and will be removed in a future version. Choose from `dpmsolver++` or `sde-dpmsolver++` insteadz+algorithm_types dpmsolver and sde-dpmsolverú1.0.0)rL   r8   rM   úsde-dpmsolver++Údeisr8   )rB   z is not implemented for )r9   Úheun)ÚlogrhoÚbh1Úbh2r9   )rC   ©r8   rO   r:   z`final_sigmas_type` z' is not supported for `algorithm_type` z$. Please choose `sigma_min` instead.r   éÿÿÿÿr7   ©Údtyper   )r   r   ÚNotImplementedErrorr&   r   r)   r   r   ÚcopyÚtorchÚ
from_numpyÚtoÚfloat32r   r   Úmodel_outputsÚlower_order_numsÚ_step_indexÚ_begin_indexÚitemÚ	sigma_minÚ	sigma_max)Úselfr<   r=   r>   r   Úuse_dynamic_shiftingr?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   Údeprecation_messageÚalphasr   s                       r   Ú__init__z(FlowDPMSolverMultistepScheduler.__init__€   sm  € ð( Ð;Ð;Ð;ð #s°Nð  #sð  #sð  #sÐÝÐCÀWØ)ñ+ô +ð +ð ð "
ð 
ð 
ð  Ò'Ð'Ø×'Ò'°}Ð'ÑEÔEÐEÐEå)Ø%ÐOÐO¸t¼~ÐOÐOñQô Qð Qð Ð2Ð2Ð2ØÐ6Ð6Ð6Ø×'Ò'°JÐ'Ñ?Ô?Ð?Ð?å)Ø"ÐLÐL¸D¼NÐLÐLñNô Nð Nð ð "#ð #ð #Ø'8¸FÒ'BÐ'BÝð VÐ'8ð  Vð  VÐaoð  Vð  Vð  Vñô ð ð
 $(ˆÔ Ý”˜Q Ð$7Ñ 7Ø0ñ2ô 2Ø26°$°B°$ô8ß8<º¹¼ð 	à�v‘ˆÝÔ! &Ñ)Ô)×,Ò,µ5´=Ð,ÑAÔAˆà#ð 	=à˜V‘^ qØ(-°©	°VÑ';ñ(<ñ =ˆFð ˆŒØÐ"5Ñ5ˆŒà"˜V lÑ2ˆÔØ !ˆÔØˆÔØ ˆÔð œ Rœ×-Ò-Ñ/Ô/ˆŒØœ Qœ×,Ò,Ñ.Ô.ˆŒˆˆr   c                 ó   — | j         S )zg
        The index counter for current timestep. It will increase 1 after each scheduler step.
        )ra   ©rf   s    r   Ú
step_indexz*FlowDPMSolverMultistepScheduler.step_indexÉ   s   € ð
 ÔÐr   c                 ó   — | j         S )zq
        The index for the first timestep. It should be set from pipeline with `set_begin_index` method.
        ©rb   rl   s    r   Úbegin_indexz+FlowDPMSolverMultistepScheduler.begin_indexÐ   s   € ð
 Ô Ð r   r   rp   c                 ó   — || _         dS )zÛ
        Sets the begin index for the scheduler. This function should be run from pipeline before the inference.
        Args:
            begin_index (`int`):
                The begin index for the scheduler.
        Nro   )rf   rp   s     r   Úset_begin_indexz/FlowDPMSolverMultistepScheduler.set_begin_indexØ   s   € ð (ˆÔÐÐr   r)   r   r   Úmuc                 óª  — | j         j        r|€t          d¦  «        ‚|€=t          j        | j        | j        |dz   ¦  «                             ¦   «         dd…         }| j         j        r|                      |d|¦  «        }n|€| j         j	        }||z  d|dz
  |z  z   z  }| j         j
        dk    r"d| j        d         z
  | j        d         z  dz  }n/| j         j
        d	k    rd}nt          d
| j         j
        › �¦  «        ‚|| j         j        z  }t          j        ||gg¦  «                             t          j        ¦  «        }t!          j        |¦  «        | _        t!          j        |¦  «                             |t           j        ¬¦  «        | _        t-          |¦  «        | _        dg| j         j        z  | _        d| _        d| _        d| _        dS )a†  
        Sets the discrete timesteps used for the diffusion chain (to be run before inference).
        Args:
            num_inference_steps (`int`):
                Total number of the spacing of the time steps.
            device (`str` or `torch.device`, *optional*):
                The device to which the timesteps should be moved to. If `None`, the timesteps are not moved.
        NzR you have to pass a value for `mu` when `use_dynamic_shifting` is set to be `True`r   rV   r7   rd   r   ç      à?r:   zC`final_sigmas_type` must be one of 'zero', or 'sigma_min', but got ©r   rX   )Úconfigrg   r   r   r   re   rd   rZ   Ú
time_shiftr   rF   Úalphas_cumprodr<   ÚconcatenateÚastyper^   r[   r\   r   r]   Úint64r   r'   r)   r=   r_   r`   ra   rb   )rf   r)   r   r   rs   r   Ú
sigma_lastr   s           r   r#   z-FlowDPMSolverMultistepScheduler.set_timestepsâ   s  € ð" Œ;Ô+ð 	°°
ÝØdñô ð ð ˆ>Ý”[ ¤°´Ø!4Ø!"ñ"#ñ$ô $ç$(¢D¡F¤F¨3¨B¨3ô0ˆFð Œ;Ô+ð 	=Ø—_’_ R¨¨fÑ5Ô5ˆFˆFàˆ}ØœÔ)�Ø˜V‘^ qØ(-°©	°VÑ';ñ(<ñ =ˆFð Œ;Ô(¨KÒ7Ð7Ø˜tÔ2°1Ô5Ñ5ØÔ-¨aÔ0ñ1Ø36ñ7ˆJˆJàŒ[Ô*¨fÒ4Ð4ØˆJˆJåØuÐVZÔVaÔVsÐuÐuñô ð ð ˜Tœ[Ô<Ñ<ˆ	Ý” ¨*¨ð !"ñ #ô #ß#)¢6­"¬*Ñ#5Ô#5ð 	õ Ô& vÑ.Ô.ˆŒÝÔ)¨)Ñ4Ô4×7Ò7Ø¥¤ð 8ñ .ô .ˆŒõ $' y¡>¤>ˆÔ ð ð
àŒKÔ$ñ%ˆÔð !"ˆÔàˆÔØ ˆÔÐÐr   ÚsampleÚreturnc                 ó,  — |j         }|j        ^}}}|t          j        t          j        fvr|                     ¦   «         }|                     ||t          j        |¦  «        z  ¦  «        }| 	                    ¦   «         }t          j
        || j        j        d¬¦  «        }t          j        |d| j        j        ¬¦  «        }|                     d¦  «        }t          j        || |¦  «        |z  } |j        ||g|¢R Ž }|                     |¦  «        }|S )ar  
        "Dynamic thresholding: At each sampling step we set s to a certain percentile absolute pixel value in xt0 (the
        prediction of x_0 at timestep t), and if s > 1, then we threshold xt0 to the range [-s, s] and then divide by
        s. Dynamic thresholding pushes saturated pixels (those near -1 and 1) inwards, thereby actively preventing
        pixels from saturation at each step. We find that dynamic thresholding results in significantly better
        photorealism as well as better image-text alignment, especially when using very large guidance weights."
        https://arxiv.org/abs/2205.11487
        r   )Údim)ÚminÚmax)rX   Úshaper[   r^   Úfloat64ÚfloatÚreshaper   ÚprodÚabsÚquantilerw   r@   ÚclamprA   Ú	unsqueezer]   )rf   r~   rX   Ú
batch_sizeÚchannelsÚremaining_dimsÚ
abs_sampleÚss           r   Ú_threshold_samplez1FlowDPMSolverMultistepScheduler._threshold_sample$  s%  € ð ”ˆØ06´Ð-ˆ
�H˜~à�œ­¬Ð6Ð6Ð6Ø—\’\ñ ô ˆFð —’ 
¨Hµr´w¸~Ñ7NÔ7NÑ,NÑOÔOˆà—Z’Z‘\”\ˆ
åŒNØ˜œÔ>ÀAðGñ Gô GˆåŒKØ�1˜$œ+Ô6ð
ñ 
ô 
ˆð �KŠKØñô ˆå”Ø�Q�B˜ñ
ô 
àñˆð  �” 
¨HÐF°~ÐFÐFÐFˆØ—’˜5Ñ!Ô!ˆàˆr   c                 ó    — || j         j        z  S ©N©rw   r<   ©rf   r   s     r   Ú_sigma_to_tz+FlowDPMSolverMultistepScheduler._sigma_to_tJ  s   € Ø�t”{Ô6Ñ6Ð6r   c                 ó   — d|z
  |fS ©Nr   r   r–   s     r   Ú_sigma_to_alpha_sigma_tz7FlowDPMSolverMultistepScheduler._sigma_to_alpha_sigma_tM  s   € Ø�5‰y˜%ÐÐr   r   Útc                 ól   — t          j        |¦  «        t          j        |¦  «        d|z  dz
  |z  z   z  S r™   )ÚmathÚexp)rf   rs   r   r›   s       r   rx   z*FlowDPMSolverMultistepScheduler.time_shiftQ  s/   € ÝŒx˜‰|Œ|�tœx¨™|œ|¨q°1©u°q©y¸5Ñ.@Ñ@ÑAÐAr   ©r~   Úmodel_outputc                ó  — t          |¦  «        dk    r|d         n|                     dd¦  «        }|€+t          |¦  «        dk    r	|d         }nt          d¦  «        ‚|�t          ddd¦  «         | j        j        d	v rk| j        j        d
k    r| j        | j                 }|||z  z
  }nt          d| j        j        › d�¦  «        ‚| j        j	        r|  
                    |¦  «        }|S | j        j        dv r�| j        j        d
k    r| j        | j                 }|d|z
  |z  z
  }nt          d| j        j        › d�¦  «        ‚| j        j	        r4| j        | j                 }|||z  z
  }|  
                    |¦  «        }||z   }|S dS )a+  
        Convert the model output to the corresponding type the DPMSolver/DPMSolver++ algorithm needs. DPM-Solver is
        designed to discretize an integral of the noise prediction model, and DPM-Solver++ is designed to discretize an
        integral of the data prediction model.
        <Tip>
        The algorithm and model type are decoupled. You can use either DPMSolver or DPMSolver++ for both noise
        prediction and data prediction models.
        </Tip>
        Args:
            model_output (`torch.Tensor`):
                The direct output from the learned diffusion model.
            sample (`torch.Tensor`):
                A current instance of a sample created by the diffusion process.
        Returns:
            `torch.Tensor`:
                The converted model output.
        r   ÚtimestepNr   z/missing `sample` as a required keyward argumentr   rN   ú‡Passing `timesteps` is deprecated and has no effect as model output conversion is now handled via an internal counter `self.step_index`rU   r6   zprediction_type given as zr must be one of `epsilon`, `sample`, `v_prediction`, or `flow_prediction` for the FlowDPMSolverMultistepScheduler.rK   zq must be one of `epsilon`, `sample`, `v_prediction` or `flow_prediction` for the FlowDPMSolverMultistepScheduler.)r'   Úpopr   r   rw   rB   r>   r   rm   r?   r’   )	rf   r    r~   Úargsr*   r¢   Úsigma_tÚx0_predÚepsilons	            r   Úconvert_model_outputz4FlowDPMSolverMultistepScheduler.convert_model_outputU  sò  € õ0 " $™iœi¨!šm˜m�4˜”7�7°·²¸JÈÑ1MÔ1MˆØˆ>Ý�4‰yŒy˜1Š}ˆ}Ø˜aœ��å ØEñGô Gð GàÐÝØØð Zñô ð ð Œ;Ô%Ð)KÐKÐKØŒ{Ô*Ð.?Ò?Ð?Øœ+ d¤oÔ6�Ø  7¨\Ñ#9Ñ9��å ðe°´Ô0Kð eð eð eñô ð ð
 Œ{Ô'ð :Ø×0Ò0°Ñ9Ô9�àˆNð Œ[Ô'Ð+IÐIÐIØŒ{Ô*Ð.?Ò?Ð?Øœ+ d¤oÔ6�Ø  A¨¡K°<Ñ#?Ñ?��å ðd°´Ô0Kð dð dð dñô ð ð
 Œ{Ô'ð 1Øœ+ d¤oÔ6�Ø  7¨\Ñ#9Ñ9�Ø×0Ò0°Ñ9Ô9�Ø&¨Ñ0�àˆNð! JÐIr   ©r~   Únoiser«   c          	      óš  — t          |¦  «        dk    r|d         n|                     dd¦  «        }t          |¦  «        dk    r|d         n|                     dd¦  «        }|€+t          |¦  «        dk    r	|d         }nt          d¦  «        ‚|�t          dd	d
¦  «         |�t          dd	d¦  «         | j        | j        dz            | j        | j                 }	}|                      |¦  «        \  }
}|                      |	¦  «        \  }}	t          j        |
¦  «        t          j        |¦  «        z
  }t          j        |¦  «        t          j        |	¦  «        z
  }||z
  }| j	        j
        dk    r)||	z  |z  |
t          j        | ¦  «        dz
  z  |z  z
  }�n.| j	        j
        dk    r'|
|z  |z  |t          j        |¦  «        dz
  z  |z  z
  }n÷| j	        j
        dk    rw|€J ‚||	z  t          j        | ¦  «        z  |z  |
dt          j        d|z  ¦  «        z
  z  |z  z   |t          j        dt          j        d|z  ¦  «        z
  ¦  «        z  |z  z   }np| j	        j
        dk    r`|€J ‚|
|z  |z  d|t          j        |¦  «        dz
  z  z  |z  z
  |t          j        t          j        d|z  ¦  «        dz
  ¦  «        z  |z  z   }|S )aª  
        One step for the first-order DPMSolver (equivalent to DDIM).
        Args:
            model_output (`torch.Tensor`):
                The direct output from the learned diffusion model.
            sample (`torch.Tensor`):
                A current instance of a sample created by the diffusion process.
        Returns:
            `torch.Tensor`:
                The sample tensor at the previous timestep.
        r   r¢   Nr   Úprev_timestepr5   ú0 missing `sample` as a required keyward argumentr   rN   r£   ú‹Passing `prev_timestep` is deprecated and has no effect as model output conversion is now handled via an internal counter `self.step_index`r8   r7   rL   rO   ç       ÀéþÿÿÿrM   ç       @)r'   r¤   r   r   r   rm   rš   r[   Úlogrw   rB   rž   Úsqrt)rf   r    r~   r«   r¥   r*   r¢   r­   r¦   Úsigma_sÚalpha_tÚalpha_sÚlambda_tÚlambda_sÚhÚx_ts                   r   Údpm_solver_first_order_updatez=FlowDPMSolverMultistepScheduler.dpm_solver_first_order_updateŸ  s;  € õ& " $™iœi¨!šm˜m�4˜”7�7°·²¸JÈÑ1MÔ1MˆÝ#& t¡9¤9¨q¢= =˜˜Qœ˜°f·j²jØ˜Tñ7#ô 7#ˆàˆ>Ý�4‰yŒy˜1Š}ˆ}Ø˜aœ��å ØFñHô Hð HàÐÝØØð Zñô ð ð Ð$ÝØØð ^ñô ð ð  œ; t¤¸Ñ':Ô;¸T¼[ØŒOô>�ˆà×7Ò7¸Ñ@Ô@Ñˆ�Ø×7Ò7¸Ñ@Ô@Ñˆ�Ý”9˜WÑ%Ô%­¬	°'Ñ(:Ô(:Ñ:ˆÝ”9˜WÑ%Ô%­¬	°'Ñ(:Ô(:Ñ:ˆà�xÑˆØŒ;Ô%¨Ò6Ð6ØØñØ$ñ%Ø(/Ý).¬°A°2©¬¸Ñ)<ñ)>ØAMñ(NñNˆC‰Cð Œ[Ô'¨;Ò6Ð6ØØñØ$ñ%Ø(/Ý).¬°1©¬¸Ñ);ñ)=Ø@Lñ(MñMˆCˆCð Œ[Ô'Ð+<Ò<Ð<ØÐ$Ð$Ð$Ø˜gÑ%­¬	°1°"©¬Ñ5¸Ñ?Ø˜q¥5¤9¨T°A©XÑ#6Ô#6Ñ6Ñ7¸<ÑGñHà�UœZ¨­e¬i¸¸Q¹Ñ.?Ô.?Ñ(?Ñ@Ô@Ñ@À5ÑHñIˆCˆCð Œ[Ô'¨?Ò:Ð:ØÐ$Ð$Ð$Ø˜gÑ%¨Ñ/°#Ø�uœy¨™|œ|¨cÑ1Ñ2ñ34Ø6Bñ3Cñ Cà�UœZ­¬	°!°a±%Ñ(8Ô(8¸3Ñ(>Ñ?Ô?Ñ?À%ÑGñHˆCð ˆ
r   Úmodel_output_listc          	      ó  — t          |¦  «        dk    r|d         n|                     dd¦  «        }t          |¦  «        dk    r|d         n|                     dd¦  «        }|€+t          |¦  «        dk    r	|d         }nt          d¦  «        ‚|�t          ddd	¦  «         |�t          ddd
¦  «         | j        | j        dz            | j        | j                 | j        | j        dz
           }
}	}|                      |¦  «        \  }}|                      |	¦  «        \  }}	|                      |
¦  «        \  }}
t          j        |¦  «        t          j        |¦  «        z
  }t          j        |¦  «        t          j        |	¦  «        z
  }t          j        |¦  «        t          j        |
¦  «        z
  }|d         |d         }}||z
  ||z
  }}||z  }|d|z  ||z
  z  }}| j	        j
        dk    r¹| j	        j        dk    rK||	z  |z  |t          j        | ¦  «        dz
  z  |z  z
  d|t          j        | ¦  «        dz
  z  z  |z  z
  }�nÁ| j	        j        dk    rL||	z  |z  |t          j        | ¦  «        dz
  z  |z  z
  |t          j        | ¦  «        dz
  |z  dz   z  |z  z   }�nc| j	        j
        dk    rµ| j	        j        dk    rI||z  |z  |t          j        |¦  «        dz
  z  |z  z
  d|t          j        |¦  «        dz
  z  z  |z  z
  }�nú| j	        j        dk    rJ||z  |z  |t          j        |¦  «        dz
  z  |z  z
  |t          j        |¦  «        dz
  |z  dz
  z  |z  z
  }�nž| j	        j
        dk    �rZ|€J ‚| j	        j        dk    r˜||	z  t          j        | ¦  «        z  |z  |dt          j        d|z  ¦  «        z
  z  |z  z   d|dt          j        d|z  ¦  «        z
  z  z  |z  z   |t          j        dt          j        d|z  ¦  «        z
  ¦  «        z  |z  z   }�ná| j	        j        dk    rœ||	z  t          j        | ¦  «        z  |z  |dt          j        d|z  ¦  «        z
  z  |z  z   |dt          j        d|z  ¦  «        z
  d|z  z  dz   z  |z  z   |t          j        dt          j        d|z  ¦  «        z
  ¦  «        z  |z  z   }�n3| j	        j
        dk    �r"|€J ‚| j	        j        dk    r{||z  |z  d|t          j        |¦  «        dz
  z  z  |z  z
  |t          j        |¦  «        dz
  z  |z  z
  |t          j        t          j        d|z  ¦  «        dz
  ¦  «        z  |z  z   }n“| j	        j        dk    rƒ||z  |z  d|t          j        |¦  «        dz
  z  z  |z  z
  d|t          j        |¦  «        dz
  |z  dz
  z  z  |z  z
  |t          j        t          j        d|z  ¦  «        dz
  ¦  «        z  |z  z   }|S )aÈ  
        One step for the second-order multistep DPMSolver.
        Args:
            model_output_list (`List[torch.Tensor]`):
                The direct outputs from learned diffusion model at current and latter timesteps.
            sample (`torch.Tensor`):
                A current instance of a sample created by the diffusion process.
        Returns:
            `torch.Tensor`:
                The sample tensor at the previous timestep.
        r   Útimestep_listNr   r­   r5   r®   rN   ú‹Passing `timestep_list` is deprecated and has no effect as model output conversion is now handled via an internal counter `self.step_index`r¯   rV   r±   r7   r8   r9   ru   rQ   rL   rO   r°   rM   r²   )r'   r¤   r   r   r   rm   rš   r[   r³   rw   rB   rC   rž   r´   )rf   r½   r~   r«   r¥   r*   r¿   r­   r¦   Úsigma_s0Úsigma_s1r¶   Úalpha_s0Úalpha_s1r¸   Ú	lambda_s0Ú	lambda_s1Úm0Úm1rº   Úh_0Úr0ÚD0ÚD1r»   s                            r   Ú(multistep_dpm_solver_second_order_updatezHFlowDPMSolverMultistepScheduler.multistep_dpm_solver_second_order_updateæ  só  € õ& $' t¡9¤9¨q¢= =˜˜Qœ˜°f·j²jØ˜Tñ7#ô 7#ˆå#& t¡9¤9¨q¢= =˜˜Qœ˜°f·j²jØ˜Tñ7#ô 7#ˆàˆ>Ý�4‰yŒy˜1Š}ˆ}Ø˜aœ��å ØFñHô Hð HàÐ$ÝØØð ^ñô ð ð Ð$ÝØØð ^ñô ð ð ŒK˜œ¨!Ñ+Ô,ØŒK˜œÔ(ØŒK˜œ¨!Ñ+Ô,ð $�ˆð  ×7Ò7¸Ñ@Ô@Ñˆ�Ø!×9Ò9¸(ÑCÔCÑˆ�(Ø!×9Ò9¸(ÑCÔCÑˆ�(å”9˜WÑ%Ô%­¬	°'Ñ(:Ô(:Ñ:ˆÝ”I˜hÑ'Ô'­%¬)°HÑ*=Ô*=Ñ=ˆ	Ý”I˜hÑ'Ô'­%¬)°HÑ*=Ô*=Ñ=ˆ	à" 2Ô&Ð(9¸"Ô(=ˆBˆà˜IÑ% y°9Ñ'<ˆ3ˆØ�1‰WˆØ�c˜B‘h 2¨¡7Ñ+ˆBˆØŒ;Ô%¨Ò6Ð6àŒ{Ô&¨*Ò4Ð4Ø (Ñ*¨fÑ4Ø¥5¤9¨a¨R¡=¤=°3Ñ#6Ñ7¸2Ñ=ñ>Ø@CØ¥5¤9¨a¨R¡=¤=°3Ñ#6Ñ7ñA9Ø;=ñA>ñ>�‘ð ”Ô(¨FÒ2Ð2Ø (Ñ*¨fÑ4Ø¥5¤9¨a¨R¡=¤=°3Ñ#6Ñ7¸2Ñ=ñ>à¥E¤I¨q¨b¡M¤M°CÑ$7¸1Ñ#<¸sÑ#BÑCÀrÑIñJ�ùð Œ[Ô'¨;Ò6Ð6àŒ{Ô&¨*Ò4Ð4Ø (Ñ*¨fÑ4Ø¥5¤9¨Q¡<¤<°#Ñ#5Ñ6¸"Ñ<ñ=Ø?BØ¥5¤9¨Q¡<¤<°#Ñ#5Ñ6ñ@8Ø:<ñ@=ñ=�‘ð ”Ô(¨FÒ2Ð2Ø (Ñ*¨fÑ4Ø¥5¤9¨Q¡<¤<°#Ñ#5Ñ6¸"Ñ<ñ=à¥E¤I¨a¡L¤L°3Ñ$6¸!Ñ#;¸cÑ#AÑBÀbÑHñI�ùð Œ[Ô'Ð+<Ò<Ñ<ØÐ$Ð$Ð$ØŒ{Ô&¨*Ò4Ð4Ø (Ñ*­U¬Y¸°r©]¬]Ñ:¸fÑDØ 1¥u¤y°¸±Ñ':Ô':Ñ#:Ñ;¸rÑAñBØDGØ 1¥u¤y°¸±Ñ':Ô':Ñ#:Ñ;ñE=Ø?AñEBñBð ¥¤¨Cµ%´)¸BÀ¹FÑ2CÔ2CÑ,CÑ!DÔ!DÑDÀuÑLñM�‘ð ”Ô(¨FÒ2Ð2Ø (Ñ*­U¬Y¸°r©]¬]Ñ:¸fÑDØ 1¥u¤y°¸±Ñ':Ô':Ñ#:Ñ;¸rÑAñBà C­%¬)°D¸1±HÑ*=Ô*=Ñ$=Ø$(¨1¡Hñ$.Ø03ñ$4ñ 5Ø8:ñ;ñ;ð ¥¤¨Cµ%´)¸BÀ¹FÑ2CÔ2CÑ,CÑ!DÔ!DÑDÀuÑLñ	M�ùð
 Œ[Ô'¨?Ò:Ñ:ØÐ$Ð$Ð$ØŒ{Ô&¨*Ò4Ð4Ø (Ñ*¨fÑ4°sØ¥5¤9¨Q¡<¤<°#Ñ#5Ñ6ñ88Ø:<ñ8=ñ =à¥5¤9¨Q¡<¤<°#Ñ#5Ñ6¸"Ñ<ñ=ð ¥¤­E¬I°a¸!±eÑ,<Ô,<¸sÑ,BÑ!CÔ!CÑCÀeÑKñL��ð ”Ô(¨FÒ2Ð2Ø (Ñ*¨fÑ4°sØ¥5¤9¨Q¡<¤<°#Ñ#5Ñ6ñ88Ø:<ñ8=ñ =Ø?BØ¥E¤I¨a¡L¤L°3Ñ$6¸!Ñ#;¸cÑ#AÑBñ@DØFHñ@IñIð ¥¤­E¬I°a¸!±eÑ,<Ô,<¸sÑ,BÑ!CÔ!CÑCÀeÑKñL�ð ˆ
r   c                ó  — t          |¦  «        dk    r|d         n|                     dd¦  «        }t          |¦  «        dk    r|d         n|                     dd¦  «        }|€+t          |¦  «        dk    r	|d         }nt          d¦  «        ‚|�t          ddd	¦  «         |�t          ddd
¦  «         | j        | j        dz            | j        | j                 | j        | j        dz
           | j        | j        dz
           f\  }}}	}
|                      |¦  «        \  }}|                      |¦  «        \  }}|                      |	¦  «        \  }}	|                      |
¦  «        \  }}
t          j        |¦  «        t          j        |¦  «        z
  }t          j        |¦  «        t          j        |¦  «        z
  }t          j        |¦  «        t          j        |	¦  «        z
  }t          j        |¦  «        t          j        |
¦  «        z
  }|d         |d         |d         }}}||z
  ||z
  ||z
  }}}||z  ||z  }}|}d|z  ||z
  z  d|z  ||z
  z  }}||||z   z  ||z
  z  z   }d||z   z  ||z
  z  }| j	        j
        dk    rx||z  |z  |t          j        | ¦  «        dz
  z  |z  z
  |t          j        | ¦  «        dz
  |z  dz   z  |z  z   |t          j        | ¦  «        dz
  |z   |dz  z  dz
  z  |z  z
  } n„| j	        j
        dk    rt||z  |z  |t          j        |¦  «        dz
  z  |z  z
  |t          j        |¦  «        dz
  |z  dz
  z  |z  z
  |t          j        |¦  «        dz
  |z
  |dz  z  dz
  z  |z  z
  } | S )aÃ  
        One step for the third-order multistep DPMSolver.
        Args:
            model_output_list (`List[torch.Tensor]`):
                The direct outputs from learned diffusion model at current and latter timesteps.
            sample (`torch.Tensor`):
                A current instance of a sample created by diffusion process.
        Returns:
            `torch.Tensor`:
                The sample tensor at the previous timestep.
        r   r¿   Nr   r­   r5   z/ missing`sample` as a required keyward argumentrN   rÀ   r¯   rV   r±   éýÿÿÿr7   r8   ru   rL   )r'   r¤   r   r   r   rm   rš   r[   r³   rw   rB   rž   )!rf   r½   r~   r¥   r*   r¿   r­   r¦   rÁ   rÂ   Úsigma_s2r¶   rÃ   rÄ   Úalpha_s2r¸   rÅ   rÆ   Ú	lambda_s2rÇ   rÈ   Úm2rº   rÉ   Úh_1rÊ   Úr1rË   ÚD1_0ÚD1_1rÌ   ÚD2r»   s!                                    r   Ú'multistep_dpm_solver_third_order_updatezGFlowDPMSolverMultistepScheduler.multistep_dpm_solver_third_order_updateT  s  € õ& $' t¡9¤9¨q¢= =˜˜Qœ˜°f·j²jØ˜Tñ7#ô 7#ˆå#& t¡9¤9¨q¢= =˜˜Qœ˜°f·j²jØ˜Tñ7#ô 7#ˆàˆ>Ý�4‰yŒy˜1Š}ˆ}Ø˜aœ��å ØEñGô Gð GàÐ$ÝØØð ^ñô ð ð Ð$ÝØØð ^ñô ð ð ŒK˜œ¨!Ñ+Ô,ØŒK˜œÔ(ØŒK˜œ¨!Ñ+Ô,ØŒK˜œ¨!Ñ+Ô,ð	1
Ñ-ˆ�˜8 Xð  ×7Ò7¸Ñ@Ô@Ñˆ�Ø!×9Ò9¸(ÑCÔCÑˆ�(Ø!×9Ò9¸(ÑCÔCÑˆ�(Ø!×9Ò9¸(ÑCÔCÑˆ�(å”9˜WÑ%Ô%­¬	°'Ñ(:Ô(:Ñ:ˆÝ”I˜hÑ'Ô'­%¬)°HÑ*=Ô*=Ñ=ˆ	Ý”I˜hÑ'Ô'­%¬)°HÑ*=Ô*=Ñ=ˆ	Ý”I˜hÑ'Ô'­%¬)°HÑ*=Ô*=Ñ=ˆ	à& rÔ*Ð,=Øô-Ø" 2Ô&ð ˆBˆð  Ñ*¨I¸	Ñ,AÀ9ÈyÑCX�ˆ3ˆØ�q‘˜# ™'ˆBˆØˆØ˜B‘h 2¨¡7Ñ+¨c°B©h¸2À¹7Ñ-CˆdˆØ�R˜2 ™7‘^¨¨t©Ñ4Ñ4ˆØ�R˜"‘W‰o $¨¡+Ñ.ˆØŒ;Ô%¨Ò6Ð6à˜hÑ&¨&Ñ0Ø�uœy¨!¨™}œ}¨sÑ2Ñ3°rÑ9ñ:à¥¤	¨1¨"¡¤°Ñ 3°qÑ8¸3Ñ>Ñ?À2ÑEñFð ¥¤	¨1¨"¡¤°Ñ 3°aÑ 7¸1¸a¹4Ñ?À#ÑEÑFÈ"ÑLñMˆCˆCð Œ[Ô'¨;Ò6Ð6à˜hÑ&¨&Ñ0°GÝ5:´Y¸q±\´\ÀCÑ5Gñ5IØLNñ4Oñ Oà¥¤	¨!¡¤¨sÑ 2°aÑ7¸#Ñ=Ñ>À"ÑDñEð ¥¤	¨!¡¤¨sÑ 2°QÑ 6¸!¸Q¹$Ñ>ÀÑDÑEÈÑKñLˆCð ˆ
r   c                 ó¦   — |€| j         }||k                         ¦   «         }t          |¦  «        dk    rdnd}||                              ¦   «         S r   )r   Únonzeror'   rc   )rf   r¢   Úschedule_timestepsÚindicesÚposs        r   Úindex_for_timestepz2FlowDPMSolverMultistepScheduler.index_for_timestep§  sW   € ØÐ%Ø!%¤Ðà%¨Ò1×:Ò:Ñ<Ô<ˆõ �w‘<”< !Ò#Ð#ˆaˆa¨ˆà�sŒ|× Ò Ñ"Ô"Ð"r   c                 óÖ   — | j         €Ut          |t          j        ¦  «        r|                     | j        j        ¦  «        }|                      |¦  «        | _        dS | j	        | _        dS )zF
        Initialize the step_index counter for the scheduler.
        N)
rp   Ú
isinstancer[   ÚTensorr]   r   r   rß   ra   rb   )rf   r¢   s     r   Ú_init_step_indexz0FlowDPMSolverMultistepScheduler._init_step_indexµ  sd   € ð
 ÔÐ#Ý˜(¥E¤LÑ1Ô1ð >Ø#Ÿ;š; t¤~Ô'<Ñ=Ô=�Ø#×6Ò6°xÑ@Ô@ˆDÔÐÐà#Ô0ˆDÔÐÐr   r¢   Úvariance_noiseÚreturn_dictc                 ó\  — | j         €t          d¦  «        ‚| j        €|                      |¦  «         | j        t	          | j        ¦  «        dz
  k    o?| j        j        p3| j        j        ot	          | j        ¦  «        dk     p| j        j	        dk    }| j        t	          | j        ¦  «        dz
  k    o#| j        j        ot	          | j        ¦  «        dk     }|  
                    ||¬¦  «        }t          | j        j        dz
  ¦  «        D ]}	| j        |	dz            | j        |	<   Œ|| j        d<   |                     t          j        ¦  «        }| j        j        d	v r*|€(t%          |j        ||j        t          j        ¬
¦  «        }
n7| j        j        d	v r'|                     |j        t          j        ¬¦  «        }
nd}
| j        j        dk    s| j        dk     s|r|                      |||
¬¦  «        }nW| j        j        dk    s| j        dk     s|r|                      | j        ||
¬¦  «        }n|                      | j        |¬¦  «        }| j        | j        j        k     r| xj        dz  c_        |                     |j        ¦  «        }| xj        dz  c_        |s|fS t7          |¬¦  «        S )aÜ  
        Predict the sample from the previous timestep by reversing the SDE. This function propagates the sample with
        the multistep DPMSolver.
        Args:
            model_output (`torch.Tensor`):
                The direct output from learned diffusion model.
            timestep (`int`):
                The current discrete timestep in the diffusion chain.
            sample (`torch.Tensor`):
                A current instance of a sample created by the diffusion process.
            generator (`torch.Generator`, *optional*):
                A random number generator.
            variance_noise (`torch.Tensor`):
                Alternative to generating noise with `generator` by directly providing the noise for the variance
                itself. Useful for methods such as [`LEdits++`].
            return_dict (`bool`):
                Whether or not to return a [`~schedulers.scheduling_utils.SchedulerOutput`] or `tuple`.
        Returns:
            [`~schedulers.scheduling_utils.SchedulerOutput`] or `tuple`:
                If return_dict is `True`, [`~schedulers.scheduling_utils.SchedulerOutput`] is returned, otherwise a
                tuple is returned where the first element is the sample tensor.
        NzaNumber of inference steps is 'None', you need to run 'set_timesteps' after creating the schedulerr   é   r:   r5   rŸ   rV   )rM   rO   )Ú	generatorr   rX   rv   rª   )Úprev_sample)r)   r   rm   rã   r'   r   rw   rE   rD   rF   r©   Úranger=   r_   r]   r[   r^   rB   r   r„   r   r`   r¼   rÍ   rÙ   rX   ra   r   )rf   r    r¢   r~   rè   rä   rå   rD   Úlower_order_secondÚir«   ré   s               r   Ústepz$FlowDPMSolverMultistepScheduler.stepÂ  s  € ð> Ô#Ð+ÝØsñô ð ð Œ?Ð"Ø×!Ò! (Ñ+Ô+Ð+ð "œ_µ°D´NÑ0CÔ0CÀaÑ0GÒGð 5ØŒKÔ&ð 4ØŒ[Ô*ÐG­s°4´>Ñ/BÔ/BÀRÒ/Gð4àŒKÔ)¨VÒ3ð 	ð  $œµ#°d´nÑ2EÔ2EÈÑ2IÒIð 7Ø"œkÔ;ð7å! $¤.Ñ1Ô1°BÒ6ð 	ð ×0Ò0°ÀfÐ0ÑMÔMˆÝ�t”{Ô/°!Ñ3Ñ4Ô4ð 	>ð 	>ˆAØ$(Ô$6°q¸1±uÔ$=ˆDÔ˜qÑ!Ð!Ø!-ˆÔ˜2Ñð —’�5œ=Ñ)Ô)ˆØŒ;Ô%ð *+ð +ð +Ø/=Ð/EÝ ØÔ"Ø#Ø#Ô*Ý”mð	%ñ %ô %ˆEˆEð
 Œ[Ô'Ð+OÐOÐOØ"×%Ò%Ø#Ô*Ý”mð &ñ %ô %ˆEˆEð ˆEàŒ;Ô# qÒ(Ð(¨DÔ,AÀAÒ,EÐ,EÐIZÐ,EØ×<Ò<Ø V°5ð =ñ :ô :ˆKˆKàŒ[Ô%¨Ò*Ð*¨dÔ.CÀaÒ.GÐ.GÐK]Ð.GØ×GÒGØÔ"¨6¸ð Hñ @ô @ˆKˆKð ×FÒFØÔ"¨6ð Gñ 3ô 3ˆKð Ô  4¤;Ô#;Ò;Ð;ØÐ!Ô! QÑ&Ð!Ô!ð "—n’n \Ô%7Ñ8Ô8ˆð 	ÐÔ˜AÑÐÔàð 	"Ø�>Ð!å¨;Ð7Ñ7Ô7Ð7r   c                 ó   — |S )a=  
        Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
        current timestep.
        Args:
            sample (`torch.Tensor`):
                The input sample.
        Returns:
            `torch.Tensor`:
                A scaled input sample.
        r   )rf   r~   r¥   r*   s       r   Úscale_model_inputz1FlowDPMSolverMultistepScheduler.scale_model_input   s	   € ð ˆr   Úoriginal_samplesr   c                 ó–  ‡ ‡
— ‰ j                              |j        |j        ¬¦  «        }|j        j        dk    rft          j        |¦  «        rR‰ j                             |j        t
          j        ¬¦  «        Š
|                     |j        t
          j        ¬¦  «        }n9‰ j                             |j        ¦  «        Š
|                     |j        ¦  «        }‰ j	        €ˆ
ˆ fd„|D ¦   «         }n4‰ j
        �‰ j
        g|j        d         z  }n‰ j	        g|j        d         z  }||                              ¦   «         }t          |j        ¦  «        t          |j        ¦  «        k     r?|                     d¦  «        }t          |j        ¦  «        t          |j        ¦  «        k     °?‰                      |¦  «        \  }}||z  ||z  z   }	|	S )Nrv   ÚmpsrW   c                 ó<   •— g | ]}‰                      |‰¦  «        ‘ŒS r   )rß   )r2   r›   rÜ   rf   s     €€r   r4   z=FlowDPMSolverMultistepScheduler.add_noise.<locals>.<listcomp>E  s:   ø€ ð ð ð àð ×'Ò'¨Ð+=Ñ>Ô>ðð ð r   r   rV   )r   r]   r   rX   Útyper[   Úis_floating_pointr   r^   rp   rm   r„   Úflattenr'   rŒ   rš   )rf   rð   r«   r   r   Ústep_indicesr   r¶   r¦   Únoisy_samplesrÜ   s   `         @r   Ú	add_noisez)FlowDPMSolverMultistepScheduler.add_noise/  sæ  øø€ ð ”—’Ø#Ô*Ð2BÔ2Hð  ñ Jô JˆàÔ"Ô'¨5Ò0Ð0µUÔ5LØñ6ô 6Ð0ð "&¤×!2Ò!2Ø Ô'­u¬}ð "3ñ ">ô ">Ðà!ŸšØ Ô'­u¬}ð %ñ >ô >ˆIˆIð "&¤×!2Ò!2Ð3CÔ3JÑ!KÔ!KÐØ!ŸšÐ%5Ô%<Ñ=Ô=ˆIð ÔÐ#ðð ð ð ð à"ðñ ô ˆLˆLð Œ_Ð(à œOÐ,¨y¬¸qÔ/AÑAˆLˆLð !Ô,Ð-°	´ÀÔ0BÑBˆLà�|Ô$×,Ò,Ñ.Ô.ˆÝ�%”+ÑÔ¥Ð%5Ô%;Ñ!<Ô!<Ò<Ð<Ø—O’O BÑ'Ô'ˆEõ �%”+ÑÔ¥Ð%5Ô%;Ñ!<Ô!<Ò<Ð<ð  ×7Ò7¸Ñ>Ô>Ñˆ�ØÐ"2Ñ2°W¸u±_ÑDˆØÐr   c                 ó   — | j         j        S r”   r•   rl   s    r   Ú__len__z'FlowDPMSolverMultistepScheduler.__len__X  s   € ØŒ{Ô.Ð.r   )r   )NNNNNr”   )NNT))Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   Ú_compatiblesÚorderr   r†   ÚintÚstrr   Úboolrj   Úpropertyrm   rp   rr   r   r[   r   r   r#   râ   r’   r—   rš   rx   r©   r¼   rÍ   rÙ   rß   rã   r   r   rí   rï   Ú	IntTensorrù   rû   r   r   r   r/   r/   E   sH  € € € € € ð5ð 5ðn ?Ð>Ð$=Ð>Ñ>Ô>€LØ€Eàð $(ØØ0Ø!$Ø"Ø"Ø,1Ø"%Ø+Ø%Ø"&Ø$Ø+1Ø%* U¨5¡\¤\ MØ'+Ø#ð#F/ð F/à ðF/ð ðF/ð ð	F/ð
 ˜ŒðF/ð ðF/ð %*ðF/ð  ðF/ð ðF/ð ðF/ð  ðF/ð ðF/ð $ Cœ=ðF/ð "ðF/ð    ”}ð!F/ð" ð#F/ð F/ð F/ñ ÔðF/ðP ð ð  ñ „Xð ð ð!ð !ñ „Xð!ð(ð (¨3ð (ð (ð (ð (ð 15Ø+/Ø(,Ø+/Ø.2ð=!ð =!à" 3¨ 9Ô-ð=!ð �c˜5œ<Ð'Ô(ð=!ð ˜˜eœÔ%ð	=!ð
 �U˜5 $˜;Ô'Ô(ð=!ð ˜˜e T˜kÔ*Ô+ð=!ð =!ð =!ð =!ðD#¨¬ð #¸¼ð #ð #ð #ð #ðL7ð 7ð 7ð ð  ð  ðB˜Uð B¨5ð B°U´\ð Bð Bð Bð Bð  $ð	Gð Gð Gà”lðGð ”ð	Gð 
ŒðGð Gð Gð Gð\  $Ø(,ðDð Dð Dà”lðDð ”ð	Dð
 ˜œÔ%ðDð 
ŒðDð Dð Dð DðV  $Ø(,ðkð kð kà ¤Ô-ðkð ”ð	kð
 ˜œÔ%ðkð 
Œðkð kð kð kðd  $ð	Qð Qð Qà ¤Ô-ðQð ”ð	Qð 
ŒðQð Qð Qð Qðf#ð #ð #ð #ð
1ð 
1ð 
1ð$ Ø15Ø ð[8ð [8à”lð[8ð ˜˜Uœ\Ð)Ô*ð[8ð ”ð	[8ð ! ¤Ô.ð[8ð ð[8ð 
ˆ Ð%Ô	&ð[8ð [8ð [8ð [8ð|¨¬ð Ø',¤|ðð ð ð ð'àœ,ð'ð Œ|ð'ð ”?ð	'ð
 
Œð'ð 'ð 'ð 'ðR/ð /ð /ð /ð /r   r/   )NNNN)r!   r�   Útypingr   r   r   r   Únumpyr   r[   Údiffusers.configuration_utilsr   r   Ú%diffusers.schedulers.scheduling_utilsr	   r
   r   Údiffusers.utilsr   r   Údiffusers.utils.torch_utilsr   r   r-   r/   r   r   r   ú<module>r     sX  ðð
 €€€Ø €€€Ø /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /à Ð Ð Ð Ø €€€Ø IÐ IÐ IÐ IÐ IÐ IÐ IÐ IðDð Dð Dð Dð Dð Dð Dð Dð Dð Dð :Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4àÐÑÔð 	Øðð ð ð ØØØð%*ð %*ð %*ð %*ðPT/ð T/ð T/ð T/ð T/ n°kñ T/ô T/ð T/ð T/ð T/r   