
    +hY                        S SK r S SKJrJrJrJrJrJr  S SKrS SK	J
r
Jr  SSKJrJr  SSKJr  SSKJrJr  SSKJr  SS	KJrJr  SS
KJrJrJr  SSKJr  SSKJ r   \" 5       (       a  S SK!J"s  J#r$  Sr%OSr%\RL                  " \'5      r(Sr)    SS\\*   S\\\+\RX                  4      S\\\*      S\\\-      4S jjr. " S S\5      r/g)    N)CallableDictListOptionalTupleUnion)T5EncoderModelT5Tokenizer   )MultiPipelineCallbacksPipelineCallback)VaeImageProcessor)AutoencoderKLCogView3PlusTransformer2DModel)DiffusionPipeline)CogVideoXDDIMSchedulerCogVideoXDPMScheduler)is_torch_xla_availableloggingreplace_example_docstring)randn_tensor   )CogView3PipelineOutputTFa  
    Examples:
        ```python
        >>> import torch
        >>> from diffusers import CogView3PlusPipeline

        >>> pipe = CogView3PlusPipeline.from_pretrained("THUDM/CogView3-Plus-3B", torch_dtype=torch.bfloat16)
        >>> pipe.to("cuda")

        >>> prompt = "A photo of an astronaut riding a horse on mars"
        >>> image = pipe(prompt).images[0]
        >>> image.save("output.png")
        ```
num_inference_stepsdevice	timestepssigmasc                    Ub  Ub  [        S5      eUb  S[        [        R                  " U R                  5      R
                  R                  5       5      ;   nU(       d  [        SU R                   S35      eU R                  " S
X2S.UD6  U R                  n[        U5      nX14$ Ub  S[        [        R                  " U R                  5      R
                  R                  5       5      ;   nU(       d  [        SU R                   S35      eU R                  " S
XBS.UD6  U R                  n[        U5      nX14$ U R                  " U4S	U0UD6  U R                  nX14$ )a  
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.

Args:
    scheduler (`SchedulerMixin`):
        The scheduler to get timesteps from.
    num_inference_steps (`int`):
        The number of diffusion steps used when generating samples with a pre-trained model. If used, `timesteps`
        must be `None`.
    device (`str` or `torch.device`, *optional*):
        The device to which the timesteps should be moved to. If `None`, the timesteps are not moved.
    timesteps (`List[int]`, *optional*):
        Custom timesteps used to override the timestep spacing strategy of the scheduler. If `timesteps` is passed,
        `num_inference_steps` and `sigmas` must be `None`.
    sigmas (`List[float]`, *optional*):
        Custom sigmas used to override the timestep spacing strategy of the scheduler. If `sigmas` is passed,
        `num_inference_steps` and `timesteps` must be `None`.

Returns:
    `Tuple[torch.Tensor, int]`: A tuple where the first element is the timestep schedule from the scheduler and the
    second element is the number of inference steps.
zYOnly one of `timesteps` or `sigmas` can be passed. Please choose one to set custom valuesr   zThe current scheduler class zx's `set_timesteps` does not support custom timestep schedules. Please check whether you are using the correct scheduler.)r   r   r   zv'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)	schedulerr   r   r   r   kwargsaccepts_timestepsaccept_sigmass           l/home/james-whalen/.local/lib/python3.13/site-packages/diffusers/pipelines/cogview3/pipeline_cogview3plus.pyretrieve_timestepsr.   ;   s}   > !3tuu'3w/@/@AXAX/Y/d/d/i/i/k+ll .y/B/B.C Da b  	M)MfM''	!)n )) 
	 C(9(9):Q:Q(R(](](b(b(d$ee.y/B/B.C D_ `  	GvGG''	!)n )) 	 3MFMfM''	))    c            /         ^  \ rS rSrSr/ rSr/ SQrS\S\	S\
S\S	\\\4   4
U 4S
 jjr     S7S\\\\   4   S\S\S\\R*                     S\\R,                     4
S jjr        S8S\\\\   4   S\\\\\   4      S\S\S\\R2                     S\\R2                     S\S\\R*                     S\\R,                     4S jjrS9S jrS r  S:S jr\S 5       r\S 5       r \S 5       r!\S  5       r"\RF                  " 5       \$" \%5      SSSSS!SS"SS#SSSSSS$S%SSS&/S4S\\\\\   4      S\\\\\   4      S'\\   S(\\   S)\S*\\\      S+\&S\S,\&S-\\\RN                  \\RN                     4      S&\\RP                     S\\RP                     S\\RP                     S.\\)\\4      S/\)\\4   S0\S1\S2\\\*\\\+/S4   \,\-4      S3\\   S\S4\\.\)4   4*S5 jj5       5       r/S6r0U =r1$ );CogView3PlusPipelinev   a  
Pipeline for text-to-image generation using CogView3Plus.

This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)

Args:
    vae ([`AutoencoderKL`]):
        Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.
    text_encoder ([`T5EncoderModel`]):
        Frozen text-encoder. CogView3Plus uses
        [T5](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5EncoderModel); specifically the
        [t5-v1_1-xxl](https://huggingface.co/PixArt-alpha/PixArt-alpha/tree/main/t5-v1_1-xxl) variant.
    tokenizer (`T5Tokenizer`):
        Tokenizer of class
        [T5Tokenizer](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5Tokenizer).
    transformer ([`CogView3PlusTransformer2DModel`]):
        A text conditioned `CogView3PlusTransformer2DModel` to denoise the encoded image latents.
    scheduler ([`SchedulerMixin`]):
        A scheduler to be used in combination with `transformer` to denoise the encoded image latents.
ztext_encoder->transformer->vae)latentsprompt_embedsnegative_prompt_embeds	tokenizertext_encodervaetransformerr)   c                   > [         TU ]  5         U R                  XX4US9  [        U SS 5      (       a/  S[	        U R
                  R                  R                  5      S-
  -  OSU l        [        U R                  S9U l
        g )N)r6   r7   r8   r9   r)   r8      r      )vae_scale_factor)super__init__register_modulesgetattrr(   r8   configblock_out_channelsr=   r   image_processor)selfr6   r7   r8   r9   r)   r'   s         r-   r?   CogView3PlusPipeline.__init__   s|     	hq 	 	
 W^^bdikoVpVpc$((//*L*L&MPQ&Q Rvw0$BWBWXr/   Nr   promptnum_images_per_promptmax_sequence_lengthr   dtypec           	         U=(       d    U R                   nU=(       d    U R                  R                  n[        U[        5      (       a  U/OUn[        U5      nU R                  USUSSSS9nUR                  nU R                  USSS9R                  n	U	R                  S   UR                  S   :  a]  [        R                  " X5      (       dB  U R                  R                  U	S S 2US-
  S24   5      n
[        R                  S	U S
U
 35        U R                  UR                  U5      5      S   nUR                  XTS9nUR                  u  pnUR                  SUS5      nUR!                  Xb-  US5      nU$ )N
max_lengthTpt)paddingrL   
truncationadd_special_tokensreturn_tensorslongest)rN   rQ   r   zXThe following part of your input was truncated because `max_sequence_length` is set to  z	 tokens: r   )rJ   r   )_execution_devicer7   rJ   
isinstancestrr(   r6   	input_idsshapetorchequalbatch_decodeloggerwarningtorepeatview)rE   rG   rH   rI   r   rJ   
batch_sizetext_inputstext_input_idsuntruncated_idsremoved_textr4   _seq_lens                 r-   _get_t5_prompt_embeds*CogView3PlusPipeline._get_t5_prompt_embeds   s    14110**00'44&&[
nn *# % 
 %....SW.Xbb  $(<(<R(@@UcIuIu>>66qJ]`aJadfJfGf7ghLNN'(	,A
 )).*;*;F*CDQG%((u(D &++A%,,Q0EqI%**:+MwXZ[r/   T   negative_promptdo_classifier_free_guidancer4   r5   c
                 f   U=(       d    U R                   n[        U[        5      (       a  U/OUnUb  [        U5      n
OUR                  S   n
Uc  U R                  UUUUU	S9nU(       a  Uc  UR                  UR                  5      nU(       a  Uc  [        U[        5      (       a  X/-  OUnUb;  [        U5      [        U5      La$  [        S[        U5       S[        U5       S35      eU
[        U5      :w  a!  [        SU S[        U5       SU SU
 S	3	5      eU R                  UUUUU	S9nXV4$ )
a  
Encodes the prompt into text encoder hidden states.

Args:
    prompt (`str` or `List[str]`, *optional*):
        prompt to be encoded
    negative_prompt (`str` or `List[str]`, *optional*):
        The prompt or prompts not to guide the image generation. If not defined, one has to pass
        `negative_prompt_embeds` instead. Ignored when not using guidance (i.e., ignored if `guidance_scale` is
        less than `1`).
    do_classifier_free_guidance (`bool`, *optional*, defaults to `True`):
        Whether to use classifier free guidance or not.
    num_images_per_prompt (`int`, *optional*, defaults to 1):
        Number of images that should be generated per prompt. torch device to place the resulting embeddings on
    prompt_embeds (`torch.Tensor`, *optional*):
        Pre-generated text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt weighting. If not
        provided, text embeddings will be generated from `prompt` input argument.
    negative_prompt_embeds (`torch.Tensor`, *optional*):
        Pre-generated negative text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt
        weighting. If not provided, negative_prompt_embeds will be generated from `negative_prompt` input
        argument.
    max_sequence_length (`int`, defaults to `224`):
        Maximum sequence length in encoded prompt. Can be set to other values but may lead to poorer results.
    device: (`torch.device`, *optional*):
        torch device
    dtype: (`torch.dtype`, *optional*):
        torch dtype
r   )rG   rH   rI   r   rJ   z?`negative_prompt` should be the same type to `prompt`, but got z != .z`negative_prompt`: z has batch size z, but `prompt`: zT. Please make sure that passed `negative_prompt` matches the batch size of `prompt`.)
rT   rU   rV   r(   rX   rh   	new_zerostype	TypeErrorr    )rE   rG   rk   rl   rH   r4   r5   rI   r   rJ   ra   s              r-   encode_prompt"CogView3PlusPipeline.encode_prompt   s   P 1411'44&&VJ&,,Q/J  66&;$7 7 M '?+B%2%<%<]=P=P%Q"&+A+I@J?\_@`@`j+<<fuO!d6l$:O&OUVZ[jVkUl mV~Q(  s?33 )/)::J3K_J` ax/
| <33  &*%?%?&&;$7 &@ &" 44r/   c	                 V   UU[        U5      U R                  -  [        U5      U R                  -  4n	[        U[        5      (       a*  [	        U5      U:w  a  [        S[	        U5       SU S35      eUc  [        XXeS9nOUR                  U5      nXR                  R                  -  nU$ )Nz/You have passed a list of generators of length z+, but requested an effective batch size of z@. Make sure the batch size matches the length of the generators.)	generatorr   rJ   )
intr=   rU   listr(   r    r   r^   r)   init_noise_sigma)
rE   ra   num_channels_latentsheightwidthrJ   r   ru   r3   rX   s
             r-   prepare_latents$CogView3PlusPipeline.prepare_latents(  s     K4000J$///	
 i&&3y>Z+GA#i.AQ R&<'gi 
 ?"5fZGjj(G NN;;;r/   c                 n   S[        [        R                  " U R                  R                  5      R
                  R                  5       5      ;   n0 nU(       a  X$S'   S[        [        R                  " U R                  R                  5      R
                  R                  5       5      ;   nU(       a  XS'   U$ )Netaru   )r!   r"   r#   r)   stepr%   r&   )rE   ru   r   accepts_etaextra_step_kwargsaccepts_generators         r-   prepare_extra_step_kwargs.CogView3PlusPipeline.prepare_extra_step_kwargs?  s     s7#4#4T^^5H5H#I#T#T#Y#Y#[\\'*e$ (3w/@/@ATAT/U/`/`/e/e/g+hh-6k*  r/   c           
        ^  US-  S:w  d	  US-  S:w  a  [        SU SU S35      eUbW  [        U 4S jU 5       5      (       d=  [        ST R                   SU Vs/ s H  oT R                  ;  d  M  UPM     sn 35      eUb  Ub  [        S	U S
U S35      eUc  Uc  [        S5      eUbA  [        U[        5      (       d,  [        U[
        5      (       d  [        S[        U5       35      eUb  Ub  [        S	U SU S35      eUb  Ub  [        SU SU S35      eUbE  UbA  UR                  UR                  :w  a&  [        SUR                   SUR                   S35      eg g g s  snf )Nr<   r   z7`height` and `width` have to be divisible by 8 but are z and rn   c              3   @   >#    U  H  oTR                   ;   v   M     g 7fN)_callback_tensor_inputs).0krE   s     r-   	<genexpr>4CogView3PlusPipeline.check_inputs.<locals>.<genexpr>^  s      F
7Y!---7Ys   z2`callback_on_step_end_tensor_inputs` has to be in z, but found zCannot forward both `prompt`: z and `prompt_embeds`: z2. Please make sure to only forward one of the two.zeProvide either `prompt` or `prompt_embeds`. Cannot leave both `prompt` and `prompt_embeds` undefined.z2`prompt` has to be of type `str` or `list` but is z and `negative_prompt_embeds`: z'Cannot forward both `negative_prompt`: zu`prompt_embeds` and `negative_prompt_embeds` must have the same shape when passed directly, but got: `prompt_embeds` z != `negative_prompt_embeds` )r    allr   rU   rV   rw   rp   rX   )	rE   rG   rz   r{   rk   "callback_on_step_end_tensor_inputsr4   r5   r   s	   `        r-   check_inputs!CogView3PlusPipeline.check_inputsQ  s9    A:?eai1nVW]V^^cdicjjklmm-9# F
7YF
 C
 C
 DTEaEaDbbn  |^  pH  |^vw  ko  kG  kG  bGpq  |^  pH  oI  J  -";08N}o ^0 0  ^ 5w  FC)@)@TZ\`IaIaQRVW]R^Q_`aa"8"D0 9*++]_ 
 &+A+M9/9J K*++]_ 
 $)?)K""&<&B&BB --:-@-@,A B.445Q8  C *L$5 pHs   E&1E&c                     U R                   $ r   _guidance_scalerE   s    r-   guidance_scale#CogView3PlusPipeline.guidance_scale  s    ###r/   c                      U R                   S:  $ )Nr   r   r   s    r-   rl   0CogView3PlusPipeline.do_classifier_free_guidance  s    ##a''r/   c                     U R                   $ r   )_num_timestepsr   s    r-   num_timesteps"CogView3PlusPipeline.num_timesteps  s    """r/   c                     U R                   $ r   )
_interruptr   s    r-   	interruptCogView3PlusPipeline.interrupt  s    r/   2   g      @g        )r   r   pilr3   rz   r{   r   r   r   r   ru   original_sizecrops_coords_top_leftoutput_typereturn_dictcallback_on_step_endr   returnc                    [        U[        [        45      (       a  UR                  nU=(       d-    U R                  R
                  R                  U R                  -  nU=(       d-    U R                  R
                  R                  U R                  -  nU=(       d    X44nX44nU R                  UUUUUUU5        Xpl	        SU l
        Ub  [        U[        5      (       a  SnO3Ub!  [        U[        5      (       a  [        U5      nOUR                  S   nU R                  nUS:  nU R!                  UUU R"                  UUUUUS9u  pU R"                  (       a  [$        R&                  " X/SS9n[)        U R*                  UUU5      u  pe[        U5      U l        U R                  R
                  R.                  nU R1                  UU-  UUUUR2                  UU
U5      nU R5                  X5      n[$        R6                  " U/UR2                  S9n[$        R6                  " U/UR2                  S9n[$        R6                  " U/UR2                  S9nU R"                  (       aF  [$        R&                  " X/5      n[$        R&                  " UU/5      n[$        R&                  " X/5      nUR9                  U5      R;                  UU-  S5      nUR9                  U5      R;                  UU-  S5      nUR9                  U5      R;                  UU-  S5      n[=        [        U5      XPR*                  R>                  -  -
  S5      nU RA                  US	9 nSn[C        U5       GHG  u  nnU RD                  (       a  M  U R"                  (       a  [$        R&                  " U/S
-  5      OUn U R*                  RG                  U U5      n URI                  U R                  S   5      n!U R	                  U UU!UUUSS9S   n"U"RK                  5       n"U R"                  (       a)  U"RM                  S
5      u  n#n$U#U RN                  U$U#-
  -  -   n"[        U R*                  [P        5      (       d'  U R*                  RR                  " U"UU40 UDSS0D6S   nO6U R*                  RR                  " U"UUUS:  a  UUS-
     OSU40 UDSS0D6u  nnUR9                  UR2                  5      nUb\  0 n%U H  n&[U        5       U&   U%U&'   M     U" U UUU%5      n'U'RW                  SU5      nU'RW                  SU5      nU'RW                  SU5      nU[        U5      S-
  :X  d)  US-   U:  a0  US-   U R*                  R>                  -  S:X  a  URY                  5         [Z        (       d  GM2  [\        R^                  " 5         GMJ     SSS5        US:X  d?  U R`                  Rc                  XR`                  R
                  Rd                  -  SU
S9S   n(OUn(U Rf                  Ri                  U(US9n(U Rk                  5         U(       d  U(4$ [m        U(S9$ ! , (       d  f       N= f)a  
Function invoked when calling the pipeline for generation.

Args:
    prompt (`str` or `List[str]`, *optional*):
        The prompt or prompts to guide the image generation. If not defined, one has to pass `prompt_embeds`.
    negative_prompt (`str` or `List[str]`, *optional*):
        The prompt or prompts not to guide the image generation. If not defined, one has to pass
        `negative_prompt_embeds` instead. Ignored when not using guidance (i.e., ignored if `guidance_scale` is
        less than `1`).
    height (`int`, *optional*, defaults to self.transformer.config.sample_size * self.vae_scale_factor):
        The height in pixels of the generated image. If not provided, it is set to 1024.
    width (`int`, *optional*, defaults to self.transformer.config.sample_size * self.vae_scale_factor):
        The width in pixels of the generated image. If not provided it is set to 1024.
    num_inference_steps (`int`, *optional*, defaults to `50`):
        The number of denoising steps. More denoising steps usually lead to a higher quality image at the
        expense of slower inference.
    timesteps (`List[int]`, *optional*):
        Custom timesteps to use for the denoising process with schedulers which support a `timesteps` argument
        in their `set_timesteps` method. If not defined, the default behavior when `num_inference_steps` is
        passed will be used. Must be in descending order.
    guidance_scale (`float`, *optional*, defaults to `5.0`):
        Guidance scale as defined in [Classifier-Free Diffusion
        Guidance](https://huggingface.co/papers/2207.12598). `guidance_scale` is defined as `w` of equation 2.
        of [Imagen Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting
        `guidance_scale > 1`. Higher guidance scale encourages to generate images that are closely linked to
        the text `prompt`, usually at the expense of lower image quality.
    num_images_per_prompt (`int`, *optional*, defaults to `1`):
        The number of images to generate per prompt.
    generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
        One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
        to make generation deterministic.
    latents (`torch.FloatTensor`, *optional*):
        Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
        generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
        tensor will ge generated by sampling using the supplied random `generator`.
    prompt_embeds (`torch.FloatTensor`, *optional*):
        Pre-generated text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt weighting. If not
        provided, text embeddings will be generated from `prompt` input argument.
    negative_prompt_embeds (`torch.FloatTensor`, *optional*):
        Pre-generated negative text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt
        weighting. If not provided, negative_prompt_embeds will be generated from `negative_prompt` input
        argument.
    original_size (`Tuple[int]`, *optional*, defaults to (1024, 1024)):
        If `original_size` is not the same as `target_size` the image will appear to be down- or upsampled.
        `original_size` defaults to `(height, width)` if not specified. Part of SDXL's micro-conditioning as
        explained in section 2.2 of
        [https://huggingface.co/papers/2307.01952](https://huggingface.co/papers/2307.01952).
    crops_coords_top_left (`Tuple[int]`, *optional*, defaults to (0, 0)):
        `crops_coords_top_left` can be used to generate an image that appears to be "cropped" from the position
        `crops_coords_top_left` downwards. Favorable, well-centered images are usually achieved by setting
        `crops_coords_top_left` to (0, 0). Part of SDXL's micro-conditioning as explained in section 2.2 of
        [https://huggingface.co/papers/2307.01952](https://huggingface.co/papers/2307.01952).
    output_type (`str`, *optional*, defaults to `"pil"`):
        The output format of the generate image. Choose between
        [PIL](https://pillow.readthedocs.io/en/stable/): `PIL.Image.Image` or `np.array`.
    return_dict (`bool`, *optional*, defaults to `True`):
        Whether or not to return a [`~pipelines.stable_diffusion_xl.StableDiffusionXLPipelineOutput`] instead
        of a plain tuple.
    attention_kwargs (`dict`, *optional*):
        A kwargs dictionary that if specified is passed along to the `AttentionProcessor` as defined under
        `self.processor` in
        [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
    callback_on_step_end (`Callable`, *optional*):
        A function that calls at the end of each denoising steps during the inference. The function is called
        with the following arguments: `callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int,
        callback_kwargs: Dict)`. `callback_kwargs` will include a list of all tensors as specified by
        `callback_on_step_end_tensor_inputs`.
    callback_on_step_end_tensor_inputs (`List`, *optional*):
        The list of tensor inputs for the `callback_on_step_end` function. The tensors specified in the list
        will be passed as `callback_kwargs` argument. You will only be able to include variables listed in the
        `._callback_tensor_inputs` attribute of your pipeline class.
    max_sequence_length (`int`, defaults to `224`):
        Maximum sequence length in encoded prompt. Can be set to other values but may lead to poorer results.

Examples:

Returns:
    [`~pipelines.cogview3.pipeline_cogview3plus.CogView3PipelineOutput`] or `tuple`:
    [`~pipelines.cogview3.pipeline_cogview3plus.CogView3PipelineOutput`] if `return_dict` is True, otherwise a
    `tuple`. When returning a tuple, the first element is a list with the generated images.
FNr   r   g      ?)rH   r4   r5   rI   r   )dim)rJ   )totalr;   )hidden_statesencoder_hidden_statestimestepr   target_sizecrop_coordsr   r   r3   r4   r5   latent)r   ru   )r   )images)7rU   r   r   tensor_inputsr9   rB   sample_sizer=   r   r   r   rV   rw   r(   rX   rT   rr   rl   rY   catr.   r)   r   in_channelsr|   rJ   r   tensorr^   r_   maxorderprogress_bar	enumerater   scale_model_inputexpandfloatchunkr   r   r   localspopupdateXLA_AVAILABLExm	mark_stepr8   decodescaling_factorrD   postprocessmaybe_free_model_hooksr   ))rE   rG   rk   rz   r{   r   r   r   rH   r   ru   r3   r4   r5   r   r   r   r   r   r   rI   r   ra   r   rl   latent_channelsr   num_warmup_stepsr   old_pred_original_sampleitlatent_model_inputr   
noise_prednoise_pred_uncondnoise_pred_textcallback_kwargsr   callback_outputsimages)                                            r-   __call__CogView3PlusPipeline.__call__  s"   \ *-=?U,VWW1E1S1S.V4++22>>AVAVVT))00<<t?T?TT%8&o 	."	
  . *VS"9"9JJvt$<$<VJ&,,Q/J''
 '5s&:# 150B0B,,"7'#9 3 1C 	1
- ++!II'=&MSTUM *<DNNL_agir)s&	!)n **11==&&..	
 !::9J m_M<O<OPllK=8K8KL %.C-DML_L_ `++!II}&DEM))[+$>?K$)II/D.\$]!%((077
EZ8Z\]^!nnV,33JAV4VXYZ 5 8 8 @ G G
UjHjlm n s9~0CnnFZFZ0ZZ\]^%89\'+$!),1>>AEAaAaUYYy1}%=gn"%)^^%E%EFXZ[%\" 88$6$<$<Q$?@ "--"4*7%"/ + 5 % .  
 (--/
 339C9I9I!9L6%!2T5H5HO^oLo5p!pJ "$..2GHH"nn11*aqL]qkpqrstG8<8K8K"0,-E	!a%(t9 ,9 %*95G5 "**]%8%89 (3&(O?-3Xa[* @';D!Q'X$.229gFG$4$8$8-$XM-=-A-ABZ\r-s*I**A9I/IqSTuX\XfXfXlXlNlpqNq '') =LLNs - :| h&HHOOGhhoo.L.L$LZ_ktOuE E$$00K0P 	##%8O%U33[ :9s   H;X5X55
Y)r   r   r   rD   r=   )Nr      NN)NTr   NNrj   NNr   )NN)2__name__
__module____qualname____firstlineno____doc___optional_componentsmodel_cpu_offload_seqr   r
   r	   r   r   r   r   r   r?   rV   r   rv   r   rY   r   rJ   rh   boolTensorrr   r|   r   r   propertyr   rl   r   r   no_gradr   EXAMPLE_DOC_STRINGr   	GeneratorFloatTensorr   r   r   r   r   r   r   __static_attributes____classcell__)r'   s   @r-   r1   r1   v   s   , <YY %Y 	Y
 4Y /1FFGY( )-%&#&)-'+(c49n%(  #( !	(
 &( $(Z <@,0%&049=#&)-'+S5c49n%S5 "%T#Y"78S5 &*	S5
  #S5  -S5 !) 6S5 !S5 &S5 $S5l.!2 #1f $ $ ( ( # #   ]]_12 37;? $##%)- #%&MQ/359>B3717   9B#&/Q4sDI~./Q4 "%T#Y"78Q4 	Q4
 }Q4 !Q4 DI&Q4 Q4  #Q4 Q4 E%//43H"HIJQ4 %++,Q4   1 12Q4 !)):): ;Q4  c3h0Q4   %S#X!Q4" #Q4$ %Q4& '(Cd+T124DF\\]
'Q4, -1I-Q4. !/Q40 
%u,	-1Q4 3 Q4r/   r1   )NNNN)0r"   typingr   r   r   r   r   r   rY   transformersr	   r
   	callbacksr   r   rD   r   modelsr   r   pipelines.pipeline_utilsr   
schedulersr   r   utilsr   r   r   utils.torch_utilsr   pipeline_outputr   torch_xla.core.xla_modelcore	xla_modelr   r   
get_loggerr   r\   r   rv   rV   r   r   r.   r1   r   r/   r-   <module>r      s      ? ?  4 A 0 C 9 G O O - 3 ))MM			H	% & *.15%)$(8*!#8* U3,-.8* S	"	8*
 T%[!8*vt4, t4r/   