ó
    oM‡juÅ  ã            
       ó¾  • S SK r S SKrS SKJrJr  S SKrS SKJrJrJ	r	J
r
JrJr  SSKJr  SSKJr  SSKJrJr  SSKJrJr  SS	KJrJrJrJr  SS
K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&\RN                  " \(5      r)Sr*    SS\+S\+S\,S\,4S jjr-    SS\+S-  S\.\R^                  -  S-  S\0\+   S-  S\0\,   S-  4S jjr1 " S S\\5      r2g) é    N)ÚAnyÚCallable)ÚCLIPTextModelWithProjectionÚCLIPTokenizerÚLlamaForCausalLMÚPreTrainedTokenizerFastÚT5EncoderModelÚT5Tokenizeré   )ÚVaeImageProcessor)ÚHiDreamImageLoraLoaderMixin)ÚAutoencoderKLÚHiDreamImageTransformer2DModel)ÚFlowMatchEulerDiscreteSchedulerÚUniPCMultistepScheduler)Ú	deprecateÚis_torch_xla_availableÚloggingÚreplace_example_docstring)Úrandn_tensoré   )ÚDiffusionPipelineé   )ÚHiDreamImagePipelineOutputTFa¬  
    Examples:
        ```py
        >>> import torch
        >>> from transformers import AutoTokenizer, LlamaForCausalLM
        >>> from diffusers import HiDreamImagePipeline

        >>> tokenizer_4 = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3.1-8B-Instruct")
        >>> text_encoder_4 = LlamaForCausalLM.from_pretrained(
        ...     "meta-llama/Meta-Llama-3.1-8B-Instruct",
        ...     output_hidden_states=True,
        ...     output_attentions=True,
        ...     torch_dtype=torch.bfloat16,
        ... )

        >>> pipe = HiDreamImagePipeline.from_pretrained(
        ...     "HiDream-ai/HiDream-I1-Full",
        ...     tokenizer_4=tokenizer_4,
        ...     text_encoder_4=text_encoder_4,
        ...     torch_dtype=torch.bfloat16,
        ... )
        >>> pipe.enable_model_cpu_offload()

        >>> image = pipe(
        ...     'A cat holding a sign that says "Hi-Dreams.ai".',
        ...     height=1024,
        ...     width=1024,
        ...     guidance_scale=5.0,
        ...     num_inference_steps=50,
        ...     generator=torch.Generator("cuda").manual_seed(0),
        ... ).images[0]
        >>> image.save("output.png")
        ```
Úbase_seq_lenÚmax_seq_lenÚ
base_shiftÚ	max_shiftc                 ó4   • XC-
  X!-
  -  nX5U-  -
  nX-  U-   nU$ ©N© )Úimage_seq_lenr   r   r   r   ÚmÚbÚmus           ÚÆC:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\diffusers/pipelines/hidream_image/pipeline_hidream_image.pyÚcalculate_shiftr'   V   s3   € ð 
Ñ	 KÑ$>Ñ?€AØ˜Ñ%Ñ%€AØ	Ñ	˜QÑ	€BØ€Ió    Ú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*   r!   )
Ú
ValueErrorÚsetÚinspectÚ	signatureÚset_timestepsÚ
parametersÚkeysÚ	__class__r+   Úlen)Ú	schedulerr)   r*   r+   r,   ÚkwargsÚaccepts_timestepsÚaccept_sigmass           r&   Úretrieve_timestepsr;   d   s}  € ð> Ñ Ñ!3ÜÐtÓuÐuØÑØ'¬3¬w×/@Ò/@À×AXÑAXÓ/Y×/dÑ/d×/iÑ/iÓ/kÓ+lÑlÐÞ ÜØ.¨y×/BÑ/BÐ.Cð Dað bóð ð 	×ÒÐM¨)ÑMÀfÒMØ×'Ñ'ˆ	Ü! )›nÐð Ð)Ð)ð 
Ñ	Ø ¤C¬×(9Ò(9¸)×:QÑ:QÓ(R×(]Ñ(]×(bÑ(bÓ(dÓ$eÑeˆÞÜØ.¨y×/BÑ/BÐ.Cð D_ð `óð ð 	×ÒÐG vÑGÀÒGØ×'Ñ'ˆ	Ü! )›nÐð Ð)Ð)ð 	×ÒÐ 3ÑM¸FÐMÀfÒMØ×'Ñ'ˆ	ØÐ)Ð)r(   c            ;       óÒ  ^ • \ rS rSrSr/ SQrS\S\S\S\	S\S	\	S
\
S\S\S\S\4U 4S jjr    SDS\\\   -  S\S\R(                  S-  S\R*                  S-  4S jjr   SES\\\   -  S\S\R(                  S-  S\R*                  S-  4S jjr    SDS\\\   -  S\S\R(                  S-  S\R*                  S-  4S jjr                    SFS\\\   -  S-  S\\\   -  S-  S\\\   -  S-  S\\\   -  S-  S\R(                  S-  S\R*                  S-  S\S\S \\\   -  S-  S!\\\   -  S-  S"\\\   -  S-  S#\\\   -  S-  S$\\R4                     S-  S%\\R4                     S-  S&\\R4                     S-  S'\\R4                     S-  S(\R4                  S-  S)\R4                  S-  S\S*\S-  4(S+ jjr           SGS, jr SHS- jr\S. 5       r \S/ 5       r!\S0 5       r"\S1 5       r#\S2 5       r$\RJ                  " 5       \&" \'5      SSSSSSS3SS4SSSSSSSSSSSSSS5SSSS6/S4S\\\   -  S\\\   -  S-  S\\\   -  S-  S\\\   -  S-  S7\S-  S8\S-  S9\S:\\   S-  S;\S \\\   -  S-  S!\\\   -  S-  S"\\\   -  S-  S#\\\   -  S-  S\S-  S<\RP                  \\RP                     -  S-  S6\R4                  S-  S$\R4                  S-  S%\R4                  S-  S&\R4                  S-  S'\R4                  S-  S(\R4                  S-  S)\R4                  S-  S=\S-  S>\S?\)\\*4   S-  S@\+\\/S4   S-  SA\\   S\48SB jj5       5       r,SCr-U =r.$ )IÚHiDreamImagePipelineéŸ   zNtext_encoder->text_encoder_2->text_encoder_3->text_encoder_4->transformer->vae)ÚlatentsÚprompt_embeds_t5Úprompt_embeds_llama3Úpooled_prompt_embedsr7   ÚvaeÚtext_encoderÚ	tokenizerÚtext_encoder_2Útokenizer_2Útext_encoder_3Útokenizer_3Útext_encoder_4Útokenizer_4Útransformerc                 ó¨  >• [         TU ]  5         U R                  UUUUU	UUUU
UUS9  [        U S5      (       a<  U R                  b/  S[        U R                  R                  R                  5      S-
  -  OSU l        [        U R                  S-  S9U l
        SU l        [        U SS 5      b&  U R                  R                  U R                  l        g g )	N)rC   rD   rF   rH   rJ   rE   rG   rI   rK   r7   rL   rC   r   r   é   )Úvae_scale_factoré€   rK   )ÚsuperÚ__init__Úregister_modulesÚhasattrrC   r6   ÚconfigÚblock_out_channelsrO   r   Úimage_processorÚdefault_sample_sizeÚgetattrrK   Ú	eos_tokenÚ	pad_token)Úselfr7   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   r5   s               €r&   rR   ÚHiDreamImagePipeline.__init__£   sÝ   ø€ ô 	‰ÑÔà×ÑØØ%Ø)Ø)Ø)ØØ#Ø#Ø#ØØ#ð 	ñ 	
ô CJÈ$ÐPU×BVÑBVÐ[_×[cÑ[cÑ[oˆA”#�d—h‘h—o‘o×8Ñ8Ó9¸AÑ=Ò>Ðuvð 	Ôô
  1À$×BWÑBWÐZ[ÑB[Ñ\ˆÔØ#&ˆÔ Ü�4˜¨Ó-Ñ9Ø)-×)9Ñ)9×)CÑ)CˆD×ÑÕ&ð :r(   NrP   ÚpromptÚmax_sequence_lengthr*   Údtypec           	      óX  • U=(       d    U R                   nU=(       d    U R                  R                  n[        U[        5      (       a  U/OUnU R                  US[        X R
                  R                  5      SSSS9nUR                  nUR                  nU R                  USSS9R                  nUR                  S   UR                  S   :¼  a—  [        R                  " Xh5      (       d|  U R
                  R                  US S 2[        X R
                  R                  5      S-
  S24   5      n	[        R                  S	[        X R
                  R                  5       S
U	 35        U R                  UR!                  U5      UR!                  U5      S9S   n
U
R!                  XCS9n
U
$ )NÚ
max_lengthTÚpt©Úpaddingrb   Ú
truncationÚadd_special_tokensÚreturn_tensorsÚlongest©re   rh   éÿÿÿÿr   úXThe following part of your input was truncated because `max_sequence_length` is set to  ú	 tokens: )Úattention_maskr   ©r`   r*   )Ú_execution_devicerH   r`   Ú
isinstanceÚstrrI   ÚminÚmodel_max_lengthÚ	input_idsrn   ÚshapeÚtorchÚequalÚbatch_decodeÚloggerÚwarningÚto)r\   r^   r_   r*   r`   Útext_inputsÚtext_input_idsrn   Úuntruncated_idsÚremoved_textÚprompt_embedss              r&   Ú_get_t5_prompt_embedsÚ*HiDreamImagePipeline._get_t5_prompt_embedsÊ   s¤  € ð ×1˜4×1Ñ1ˆØ×2˜×,Ñ,×2Ñ2ˆä'¨´×4Ñ4�&‘¸&ˆà×&Ñ&ØØ ÜÐ.×0@Ñ0@×0QÑ0QÓRØØ#Øð 'ð 
ˆð %×.Ñ.ˆØ$×3Ñ3ˆØ×*Ñ*¨6¸9ÐUYÐ*ÐZ×dÑdˆà× Ñ  Ñ$¨×(<Ñ(<¸RÑ(@Ó@ÌÏÊÐUc×IuÑIuØ×+Ñ+×8Ñ8Ø¢¤3Ð':×<LÑ<L×<]Ñ<]Ó#^ÐabÑ#bÐegÐ#gÐ gÑhóˆLô �N‰NðÜÐ+×-=Ñ-=×-NÑ-NÓOÐPÐPYÐZfÐYgðiôð
 ×+Ñ+¨N×,=Ñ,=¸fÓ,EÐVd×VgÑVgÐhnÓVoÐ+ÐpÐqrÑsˆØ%×(Ñ(¨uÐ(ÐDˆØÐr(   c                 ó&  • U=(       d    U R                   nU=(       d    UR                  n[        U[        5      (       a  U/OUnU" US[	        US5      SSS9nUR
                  nU" USSS9R
                  n	U	R                  S   UR                  S   :¼  aP  [        R                  " X‰5      (       d5  UR                  U	S S 2S	S24   5      n
[        R                  S
S SU
 35        U" UR                  U5      SS9nUS   nUR                  XeS9nU$ )Nrb   éÚ   Trc   )re   rb   rf   rh   ri   rj   rk   éÙ   z\The following part of your input was truncated because CLIP can only handle sequences up to rm   )Úoutput_hidden_statesr   ro   )rp   r`   rq   rr   rs   ru   rv   rw   rx   ry   rz   r{   r|   )r\   rE   rD   r^   r_   r*   r`   r}   r~   r   r€   r�   s               r&   Ú_get_clip_prompt_embedsÚ,HiDreamImagePipeline._get_clip_prompt_embedsï   s%  € ð ×1˜4×1Ñ1ˆØ×+˜×+Ñ+ˆä'¨´×4Ñ4�&‘¸&ˆáØØ ÜÐ.°Ó4ØØñ
ˆð %×.Ñ.ˆÙ# F°IÈdÑS×]Ñ]ˆØ× Ñ  Ñ$¨×(<Ñ(<¸RÑ(@Ó@ÌÏÊÐUc×IuÑIuØ$×1Ñ1°/Â!ÀWÈrÀ\À/Ñ2RÓSˆLÜ�N‰NðØ�5˜	 , ð1ôñ % ^×%6Ñ%6°vÓ%>ÐUYÑZˆð & aÑ(ˆØ%×(Ñ(¨uÐ(ÐDˆØÐr(   c           	      ó€  • U=(       d    U R                   nU=(       d    U R                  R                  n[        U[        5      (       a  U/OUnU R                  US[        X R
                  R                  5      SSSS9nUR                  nUR                  nU R                  USSS9R                  nUR                  S   UR                  S   :¼  a—  [        R                  " Xh5      (       d|  U R
                  R                  US S 2[        X R
                  R                  5      S-
  S24   5      n	[        R                  S	[        X R
                  R                  5       S
U	 35        U R                  UR!                  U5      UR!                  U5      SSS9n
U
R"                  SS  n[        R$                  " USS9nU$ )Nrb   Trc   rd   ri   rj   rk   r   rl   rm   )rn   r‡   Úoutput_attentionsr   ©Údim)rp   rJ   r`   rq   rr   rK   rs   rt   ru   rn   rv   rw   rx   ry   rz   r{   r|   Úhidden_statesÚstack)r\   r^   r_   r*   r`   r}   r~   rn   r   r€   Úoutputsr�   s               r&   Ú_get_llama3_prompt_embedsÚ.HiDreamImagePipeline._get_llama3_prompt_embeds  s¹  € ð ×1˜4×1Ñ1ˆØ×2˜×,Ñ,×2Ñ2ˆä'¨´×4Ñ4�&‘¸&ˆà×&Ñ&ØØ ÜÐ.×0@Ñ0@×0QÑ0QÓRØØ#Øð 'ð 
ˆð %×.Ñ.ˆØ$×3Ñ3ˆØ×*Ñ*¨6¸9ÐUYÐ*ÐZ×dÑdˆà× Ñ  Ñ$¨×(<Ñ(<¸RÑ(@Ó@ÌÏÊÐUc×IuÑIuØ×+Ñ+×8Ñ8Ø¢¤3Ð':×<LÑ<L×<]Ñ<]Ó#^ÐabÑ#bÐegÐ#gÐ gÑhóˆLô �N‰NðÜÐ+×-=Ñ-=×-NÑ-NÓOÐPÐPYÐZfÐYgðiôð
 ×%Ñ%Ø×Ñ˜fÓ%Ø)×,Ñ,¨VÓ4Ø!%Ø"ð	 &ð 
ˆð  ×-Ñ-¨a¨bÐ1ˆÜŸš M°qÑ9ˆØÐr(   r   TÚprompt_2Úprompt_3Úprompt_4Únum_images_per_promptÚdo_classifier_free_guidanceÚnegative_promptÚnegative_prompt_2Únegative_prompt_3Únegative_prompt_4r@   rA   Únegative_prompt_embeds_t5Únegative_prompt_embeds_llama3rB   Únegative_pooled_prompt_embedsÚ
lora_scalec                 ó"  • [        U[        5      (       a  U/OUnUb  [        U5      nOUR                  S   nU=(       d    U R                  nUc)  U R                  U R                  U R                  UUXV5      nU(       a¨  Uc¥  U	=(       d    Sn	[        U	[        5      (       a  U	/OU	n	[        U	5      S:”  a  [        U	5      U:w  a  [        SU 35      eU R                  U R                  U R                  U	UXV5      nUR                  S   S:X  a  US:”  a  UR                  US5      nUc¥  U=(       d    Un[        U[        5      (       a  U/OUn[        U5      S:”  a  [        U5      U:w  a  [        SU 35      eU R                  U R                  U R                  UUXV5      nUR                  S   S:X  a  US:”  a  UR                  US5      nU(       a¨  Uc¥  U
=(       d    U	n
[        U
[        5      (       a  U
/OU
n
[        U
5      S:”  a  [        U
5      U:w  a  [        SU 35      eU R                  U R                  U R                  U
UXV5      nUR                  S   S:X  a  US:”  a  UR                  US5      nUc  [        R                  " WW/SS9nU(       a  Uc  [        R                  " WW/SS9nUc�  U=(       d    Un[        U[        5      (       a  U/OUn[        U5      S:”  a  [        U5      U:w  a  [        S	U 35      eU R                  UUXV5      nUR                  S   S:X  a  US:”  a  UR                  USS5      nU(       a“  Uc�  U=(       d    U	n[        U[        5      (       a  U/OUn[        U5      S:”  a  [        U5      U:w  a  [        S
U 35      eU R                  UUXV5      nUR                  S   S:X  a  US:”  a  UR                  USS5      nUc‘  U=(       d    Un[        U[        5      (       a  U/OUn[        U5      S:”  a  [        U5      U:w  a  [        SU 35      eU R                  UUXV5      nUR                  S   S:X  a  US:”  a  UR                  SUSS5      nU(       a”  Uc‘  U=(       d    U	n[        U[        5      (       a  U/OUn[        U5      S:”  a  [        U5      U:w  a  [        SU 35      eU R                  UUXV5      nUR                  S   S:X  a  US:”  a  UR                  SUSS5      nUR                  SU5      nUR!                  UU-  S5      nUR                  u  nnnUS:X  a  US:”  a  UR                  USS5      nOUS:”  a  UU:w  a  [        SU 35      eUR                  SUS5      nUR!                  UU-  US5      nUR                  u  nnnnUS:X  a  US:”  a  UR                  SUSS5      nOUS:”  a  UU:w  a  [        SU 35      eUR                  SSUS5      nUR!                  SUU-  UU5      nU(       GaY  UR                  u  nnUS:X  a  US:”  a  UR                  US5      nOUS:”  a  UU:w  a  [        SU 35      eUR                  SU5      nUR!                  UU-  S5      nUR                  u  nnnUS:X  a  US:”  a  UR                  USS5      nOUS:”  a  UU:w  a  [        SU 35      eUR                  SUS5      nUR!                  UU-  US5      nUR                  u  nnnnUS:X  a  US:”  a  UR                  SUSS5      nOUS:”  a  UU:w  a  [        SU 35      eUR                  SSUS5      nUR!                  SUU-  UU5      nUUUUUU4$ )Nr   Ú r   z'negative_prompt must be of length 1 or z prompt_2 must be of length 1 or z)negative_prompt_2 must be of length 1 or rk   rŒ   z prompt_3 must be of length 1 or z)negative_prompt_3 must be of length 1 or z prompt_4 must be of length 1 or z)negative_prompt_4 must be of length 1 or z0cannot duplicate prompt_embeds_t5 of batch size z4cannot duplicate prompt_embeds_llama3 of batch size z=cannot duplicate negative_pooled_prompt_embeds of batch size z9cannot duplicate negative_prompt_embeds_t5 of batch size z=cannot duplicate negative_prompt_embeds_llama3 of batch size )rq   rr   r6   rv   rp   rˆ   rE   rD   r.   ÚrepeatrG   rF   rw   Úcatr‚   r‘   Úview)r\   r^   r“   r”   r•   r*   r`   r–   r—   r˜   r™   rš   r›   r@   rA   rœ   r�   rB   rž   r_   rŸ   Ú
batch_sizeÚpooled_prompt_embeds_1Únegative_pooled_prompt_embeds_1Úpooled_prompt_embeds_2Únegative_pooled_prompt_embeds_2Úbs_embedÚseq_lenÚ_r�   s                                 r&   Úencode_promptÚ"HiDreamImagePipeline.encode_prompt@  sm  € ô. (¨´×4Ñ4�&‘¸&ˆØÑÜ˜V›‰Jà-×3Ñ3°AÑ6ˆJà×1˜4×1Ñ1ˆàÑ'Ø%)×%AÑ%AØ—‘ × 1Ñ 1°6Ð;NÐPVó&Ð"ö 'Ð+HÑ+PØ-×3°ˆOÜ3=¸oÌs×3SÑ3S˜Ñ/ÐYhˆOä�?Ó# aÓ'¬C°Ó,@ÀJÓ,NÜ Ð#JÈ:È,Ð!WÓXÐXà.2×.JÑ.JØ—‘ × 1Ñ 1°?ÐDWÐY_ó/Ð+ð /×4Ñ4°QÑ7¸1Ó<ÀÈaÃØ2Q×2XÑ2XÐYcÐefÓ2gÐ/àÑ'Ø×) 6ˆHÜ%/°¼#×%>Ñ%>˜‘zÀHˆHä�8‹}˜qÓ ¤S¨£]°jÓ%@Ü Ð#CÀJÀ<Ð!PÓQÐQà%)×%AÑ%AØ× Ñ  $×"5Ñ"5°xÐATÐV\ó&Ð"ð &×+Ñ+¨AÑ.°!Ó3¸
ÀQ»Ø)?×)FÑ)FÀzÐSTÓ)UÐ&æ&Ð+HÑ+PØ 1× D°_ÐÜ7AÐBSÔUX×7YÑ7YÐ!2Ñ 3Ð_pÐäÐ$Ó%¨Ó)¬cÐ2CÓ.DÈ
Ó.RÜ Ð#LÈZÈLÐ!YÓZÐZà.2×.JÑ.JØ× Ñ  $×"5Ñ"5Ð7HÐJ]Ð_eó/Ð+ð /×4Ñ4°QÑ7¸1Ó<ÀÈaÃØ2Q×2XÑ2XÐYcÐefÓ2gÐ/àÑ'Ü#(§9¢9Ð.DÐF\Ð-]ÐceÑ#fÐ æ&Ð+HÑ+PÜ,1¯IªIØ0Ð2QÐRÐXZñ-Ð)ð Ñ#Ø×) 6ˆHÜ%/°¼#×%>Ñ%>˜‘zÀHˆHä�8‹}˜qÓ ¤S¨£]°jÓ%@Ü Ð#CÀJÀ<Ð!PÓQÐQà#×9Ñ9¸(ÐDWÐY_ÓgÐà×%Ñ% aÑ(¨AÓ-°*¸q³.Ø#3×#:Ñ#:¸:ÀqÈ!Ó#LÐ æ&Ð+DÑ+LØ 1× D°_ÐÜ7AÐBSÔUX×7YÑ7YÐ!2Ñ 3Ð_pÐäÐ$Ó%¨Ó)¬cÐ2CÓ.DÈ
Ó.RÜ Ð#LÈZÈLÐ!YÓZÐZà(,×(BÑ(BØ!Ð#6¸ó)Ð%ð )×.Ñ.¨qÑ1°QÓ6¸:È»>Ø,E×,LÑ,LÈZÐYZÐ\]Ó,^Ð)àÑ'Ø×) 6ˆHÜ%/°¼#×%>Ñ%>˜‘zÀHˆHä�8‹}˜qÓ ¤S¨£]°jÓ%@Ü Ð#CÀJÀ<Ð!PÓQÐQà#'×#AÑ#AÀ(ÐL_ÐagÓ#oÐ à#×)Ñ)¨!Ñ,°Ó1°jÀ1³nØ';×'BÑ'BÀ1ÀjÐRSÐUVÓ'WÐ$æ&Ð+HÑ+PØ 1× D°_ÐÜ7AÐBSÔUX×7YÑ7YÐ!2Ñ 3Ð_pÐäÐ$Ó%¨Ó)¬cÐ2CÓ.DÈ
Ó.RÜ Ð#LÈZÈLÐ!YÓZÐZà,0×,JÑ,JØ!Ð#6¸ó-Ð)ð -×2Ñ2°1Ñ5¸Ó:¸zÈA»~Ø0M×0TÑ0TÐUVÐXbÐdeÐghÓ0iÐ-ð  4×:Ñ:¸1Ð>SÓTÐØ3×8Ñ8¸ÐF[Ñ9[Ð]_Ó`Ðð  0×5Ñ5Ñˆ�'˜1Ø�q‹=˜Z¨!›^Ø/×6Ñ6°zÀ1ÀaÓHÑØ˜‹\˜h¨*Ó4ÜÐOÐPXÈzÐZÓ[Ð[Ø+×2Ñ2°1Ð6KÈQÓOÐØ+×0Ñ0°Ð>SÑ1SÐU\Ð^`ÓaÐð %9×$>Ñ$>Ñ!ˆˆ8�W˜cØ�q‹=˜Z¨!›^Ø#7×#>Ñ#>¸qÀ*ÈaÐQRÓ#SÑ Ø˜‹\˜h¨*Ó4ÜÐSÐT\ÐS]Ð^Ó_Ð_Ø3×:Ñ:¸1¸aÐAVÐXYÓZÐØ3×8Ñ8¸¸ZÐJ_Ñ=_ÐahÐjmÓnÐç&à =× CÑ CÑˆH�gØ˜1‹} ¨a£Ø0M×0TÑ0TÐU_ÐabÓ0cÑ-Ø˜A“ (¨jÓ"8Ü Ð#`ÐaiÐ`jÐ!kÓlÐlØ,I×,PÑ,PÐQRÐTiÓ,jÐ)Ø,I×,NÑ,NÈzÐ\qÑOqÐsuÓ,vÐ)ð $=×#BÑ#BÑ ˆH�g˜qØ˜1‹} ¨a£Ø,E×,LÑ,LÈZÐYZÐ\]Ó,^Ñ)Ø˜A“ (¨jÓ"8Ü Ð#\Ð]eÐ\fÐ!gÓhÐhØ(A×(HÑ(HÈÐLaÐcdÓ(eÐ%Ø(A×(FÑ(FÀzÐTiÑGiÐkrÐtvÓ(wÐ%ð )F×(KÑ(KÑ%ˆAˆx˜ #Ø˜1‹} ¨a£Ø0M×0TÑ0TÐUVÐXbÐdeÐghÓ0iÑ-Ø˜A“ (¨jÓ"8Ü Ð#`ÐaiÐ`jÐ!kÓlÐlØ,I×,PÑ,PÐQRÐTUÐWlÐnoÓ,pÐ)Ø,I×,NÑ,NØ�JÐ!6Ñ6¸Àó-Ð)ð
 Ø%Ø Ø)Ø Ø)ð
ð 	
r(   c           
      ót  ^ • UbX  [        U 4S jU 5       5      (       d>  [        ST R                   SU Vs/ s H  nUT R                  ;  d  M  UPM     sn 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b  U	b  [        SU S	U	 S35      eUb  U
b  [        S
U SU
 S35      eUc  Uc  [        S5      eUc  U	c  [        S5      eUc  U
c  [        S5      eUbA  [        U[        5      (       d,  [        U[
        5      (       d  [        S[        U5       35      eUbA  [        U[        5      (       d,  [        U[
        5      (       d  [        S[        U5       35      eUbA  [        U[        5      (       d,  [        U[
        5      (       d  [        S[        U5       3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b  Ub  [        SU SU S35      eUb  Ub  [        SU SU S35      eUbC  Ub@  UR                  UR                  :w  a&  [        SUR                   SUR                   S35      eU	bC  Ub@  U	R                  UR                  :w  a&  [        SU	R                   SUR                   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 )!Nc              3   ó@   >#   • U  H  oTR                   ;   v •  M     g 7fr    )Ú_callback_tensor_inputs)Ú.0Úkr\   s     €r&   Ú	<genexpr>Ú4HiDreamImagePipeline.check_inputs.<locals>.<genexpr>  s   øé € ð F
Ú7Y°!�×-Ñ-Ö-Ò7Yùs   ƒz2`callback_on_step_end_tensor_inputs` has to be in z, but found zCannot forward both `prompt`: z and `pooled_prompt_embeds`: z2. Please make sure to only forward one of the two.z Cannot forward both `prompt_2`: z Cannot forward both `prompt_3`: z and `prompt_embeds_t5`: z Cannot forward both `prompt_4`: z and `prompt_embeds_llama3`: zsProvide either `prompt` or `pooled_prompt_embeds`. Cannot leave both `prompt` and `pooled_prompt_embeds` undefined.zkProvide either `prompt` or `prompt_embeds_t5`. Cannot leave both `prompt` and `prompt_embeds_t5` undefined.zsProvide either `prompt` or `prompt_embeds_llama3`. Cannot leave both `prompt` and `prompt_embeds_llama3` undefined.z2`prompt` has to be of type `str` or `list` but is z4`prompt_2` has to be of type `str` or `list` but is z4`prompt_3` has to be of type `str` or `list` but is z4`prompt_4` has to be of type `str` or `list` but is z'Cannot forward both `negative_prompt`: z& and `negative_pooled_prompt_embeds`: z)Cannot forward both `negative_prompt_2`: z)Cannot forward both `negative_prompt_3`: z" and `negative_prompt_embeds_t5`: z)Cannot forward both `negative_prompt_4`: z& and `negative_prompt_embeds_llama3`: zŠ`pooled_prompt_embeds` and `negative_pooled_prompt_embeds` must have the same shape when passed directly, but got: `pooled_prompt_embeds` z$ != `negative_pooled_prompt_embeds` Ú.z~`prompt_embeds_t5` and `negative_prompt_embeds_t5` must have the same shape when passed directly, but got: `prompt_embeds_t5` z  != `negative_prompt_embeds_t5` zŠ`prompt_embeds_llama3` and `negative_prompt_embeds_llama3` must have the same shape when passed directly, but got: `prompt_embeds_llama3` z$ != `negative_prompt_embeds_llama3` )Úallr.   r±   rq   rr   ÚlistÚtyperv   )r\   r^   r“   r”   r•   r˜   r™   rš   r›   r@   rA   rœ   r�   rB   rž   Ú"callback_on_step_end_tensor_inputsr³   s   `                r&   Úcheck_inputsÚ!HiDreamImagePipeline.check_inputs  sË  ø€ ð$ .Ñ9Ä#ô F
Ù7YóF
÷ C
ñ C
ô ØDÀT×EaÑEaÐDbÐbnñ  |^ó  pHò  |^Ðvwð  bcð  ko÷  kGñ  kGñ  bG×pqñ  |^ñ  pHð  oIð  Jóð ð ÑÐ"6Ñ"BÜØ0°°Ð8UÐVjÐUkð l0ð 0óð ð Ñ!Ð&:Ñ&FÜØ2°8°*Ð<YÐZnÐYoð p0ð 0óð ð Ñ!Ð&6Ñ&BÜØ2°8°*Ð<UÐVfÐUgð h0ð 0óð ð Ñ!Ð&:Ñ&FÜØ2°8°*Ð<YÐZnÐYoð p0ð 0óð ð ‰^Ð 4Ñ <Üð Fóð ð ‰^Ð 0Ñ 8ÜØ}óð ð ‰^Ð 4Ñ <Üð Fóð ð Ñ¬°F¼C×)@Ñ)@ÌÐTZÔ\`×IaÑIaÜÐQÔRVÐW]ÓR^ÐQ_Ð`ÓaÐaØÑ!¬:°hÄ×+DÑ+DÌZÐX`Ôbf×MgÑMgÜÐSÔTXÐYaÓTbÐScÐdÓeÐeØÑ!¬:°hÄ×+DÑ+DÌZÐX`Ôbf×MgÑMgÜÐSÔTXÐYaÓTbÐScÐdÓeÐeØÑ!¬:°hÄ×+DÑ+DÌZÐX`Ôbf×MgÑMgÜÐSÔTXÐYaÓTbÐScÐdÓeÐeàÑ&Ð+HÑ+TÜØ9¸/Ð9Jð KØ1Ð2Ð2dðfóð ð Ñ*Ð/LÑ/XÜØ;Ð<MÐ;Nð OØ1Ð2Ð2dðfóð ð Ñ*Ð/HÑ/TÜØ;Ð<MÐ;Nð OØ-Ð.Ð.`ðbóð ð Ñ*Ð/LÑ/XÜØ;Ð<MÐ;Nð OØ1Ð2Ð2dðfóð ð
  Ñ+Ð0MÑ0YØ#×)Ñ)Ð-J×-PÑ-PÓPÜ ð4Ø4H×4NÑ4NÐ3Oð PØ5×;Ñ;Ð<¸Að?óð ð
 Ñ'Ð,EÑ,QØ×%Ñ%Ð)B×)HÑ)HÓHÜ ð0Ø0@×0FÑ0FÐ/Gð HØ1×7Ñ7Ð8¸ð;óð ð
  Ñ+Ð0MÑ0YØ#×)Ñ)Ð-J×-PÑ-PÓPÜ ð4Ø4H×4NÑ4NÐ3Oð PØ5×;Ñ;Ð<¸Að?óð ð Qð 1ZÐ+ùò_ pHs   ¶L5ÁL5c	                 ó  • S[        U5      U R                  S-  -  -  nS[        U5      U R                  S-  -  -  nXX44n	Uc  [        X—XeS9nU$ UR                  U	:w  a  [	        SUR                   SU	 35      eUR                  U5      nU$ )Nr   )Ú	generatorr*   r`   zUnexpected latents shape, got z, expected )ÚintrO   r   rv   r.   r|   )
r\   r¥   Únum_channels_latentsÚheightÚwidthr`   r*   r¾   r?   rv   s
             r&   Úprepare_latentsÚ$HiDreamImagePipeline.prepare_latentst  s£   € ð ”c˜&“k d×&;Ñ&;¸aÑ&?Ñ@ÑAˆØ”S˜“Z D×$9Ñ$9¸AÑ$=Ñ>Ñ?ˆà°6ÐAˆà‰?Ü" 5ÀfÑZˆGð
 ˆð �}‰} Ó%Ü Ð#AÀ'Ç-Á-ÀÐP[Ð\aÐ[bÐ!cÓdÐdØ—j‘j Ó(ˆGØˆr(   c                 ó   • U R                   $ r    ©Ú_guidance_scale©r\   s    r&   Úguidance_scaleÚ#HiDreamImagePipeline.guidance_scaleŽ  s   € à×#Ñ#Ð#r(   c                 ó    • U R                   S:„  $ )Nr   rÆ   rÈ   s    r&   r—   Ú0HiDreamImagePipeline.do_classifier_free_guidance’  s   € à×#Ñ# aÑ'Ð'r(   c                 ó   • U R                   $ r    )Ú_attention_kwargsrÈ   s    r&   Úattention_kwargsÚ%HiDreamImagePipeline.attention_kwargs–  s   € à×%Ñ%Ð%r(   c                 ó   • U R                   $ r    )Ú_num_timestepsrÈ   s    r&   Únum_timestepsÚ"HiDreamImagePipeline.num_timestepsš  s   € à×"Ñ"Ð"r(   c                 ó   • U R                   $ r    )Ú
_interruptrÈ   s    r&   Ú	interruptÚHiDreamImagePipeline.interruptž  s   € à�‰Ðr(   é2   g      @Úpilr?   rÁ   rÂ   r)   r,   rÉ   r¾   Úoutput_typeÚreturn_dictrÏ   Úcallback_on_step_endrº   c                 óÊ  • UR                  SS5      nUR                  SS5      nUb  Sn [        SSU 5        US   nUS   nUb  Sn [        SSU 5        US   nUS   nU=(       d    U R                  U R                  -  nU=(       d    U R                  U R                  -  nU R                  S	-  n!U R                  U R                  -  S	-  n"U"Xe-  -  n#[        R
                  " U#5      n#[        UU#-  U!-  U!-  5      [        UU#-  U!-  U!-  5      pVU R                  UUUUU
UUUUUUUUUUS
9  X�l        UU l	        SU l
        Ub  [        U[        5      (       a  Sn$O6Ub!  [        U[        5      (       a  [        U5      n$OUb  UR                  S   n$U R                   n%U R"                  b  U R"                  R                  SS5      OSn&U R%                  UUUUU
UUUU R&                  UUUUUUU%UUU&S9u  nnnnnnU R&                  (       aE  [(        R*                  " UU/SS9n[(        R*                  " UU/SS9n[(        R*                  " UU/SS9nU R,                  R.                  R0                  n'U R3                  W$U-  U'UUUR4                  U%UU5      n[7        U R,                  R8                  5      n(SU(0n)[:        (       a  Sn*OU%n*[        U R<                  [>        5      (       a1  U R<                  RA                  UU*S9  U R<                  RB                  n+O[E        U R<                  UU*4SU0U)D6u  n+n[G        [        U+5      XpR<                  RH                  -  -
  S5      n,[        U+5      U l%        U RM                  US9 n-[O        U+5       GH  u  n.n/U RP                  (       a  M  U R&                  (       a  [(        R*                  " U/S	-  5      OUn0U/RS                  U0R                  S   5      n1U R-                  U0U1UUUSS9S   n2U2* n2U R&                  (       a)  U2RU                  S	5      u  n3n4U3U RV                  U4U3-
  -  -   n2UR4                  n5U R<                  RY                  U2U/USS9S   nUR4                  U5:w  a>  [(        RZ                  R\                  R_                  5       (       a  URa                  U55      nUbn  0 n6U H  n7[c        5       U7   U6U7'   M     U" U U.U/U65      n8U8Re                  SU5      nU8Re                  SU5      nU8Re                  SU5      nU8Re                  SU5      nU.[        U+5      S-
  :X  d)  U.S-   U,:”  a0  U.S-   U R<                  RH                  -  S:X  a  U-Rg                  5         [:        (       d  GMü  [h        Rj                  " 5         GM     SSS5        US:X  a  Un9O{UU Rl                  R.                  Rn                  -  U Rl                  R.                  Rp                  -   nU Rl                  Rs                  USS9S   n9U Rt                  Rw                  U9US9n9U Ry                  5         U(       d  U94$ [{        U9S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`.
        instead.
    prompt_2 (`str` or `list[str]`, *optional*):
        The prompt or prompts to be sent to `tokenizer_2` and `text_encoder_2`. If not defined, `prompt` is
        will be used instead.
    prompt_3 (`str` or `list[str]`, *optional*):
        The prompt or prompts to be sent to `tokenizer_3` and `text_encoder_3`. If not defined, `prompt` is
        will be used instead.
    prompt_4 (`str` or `list[str]`, *optional*):
        The prompt or prompts to be sent to `tokenizer_4` and `text_encoder_4`. If not defined, `prompt` is
        will be used instead.
    height (`int`, *optional*, defaults to self.unet.config.sample_size * self.vae_scale_factor):
        The height in pixels of the generated image. This is set to 1024 by default for the best results.
    width (`int`, *optional*, defaults to self.unet.config.sample_size * self.vae_scale_factor):
        The width in pixels of the generated image. This is set to 1024 by default for the best results.
    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.
    sigmas (`list[float]`, *optional*):
        Custom sigmas to use for the denoising process with schedulers which support a `sigmas` argument in
        their `set_timesteps` method. If not defined, the default behavior when `num_inference_steps` is passed
        will be used.
    guidance_scale (`float`, *optional*, defaults to 3.5):
        Embedded guiddance scale is enabled by setting `guidance_scale` > 1. Higher `guidance_scale` encourages
        a model to generate images more aligned with `prompt` at the expense of lower image quality.

        Guidance-distilled models approximates true classifer-free guidance for `guidance_scale` > 1. Refer to
        the [paper](https://huggingface.co/papers/2210.03142) to learn more.
    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 `true_cfg_scale` is
        not greater than `1`).
    negative_prompt_2 (`str` or `list[str]`, *optional*):
        The prompt or prompts not to guide the image generation to be sent to `tokenizer_2` and
        `text_encoder_2`. If not defined, `negative_prompt` is used in all the text-encoders.
    negative_prompt_3 (`str` or `list[str]`, *optional*):
        The prompt or prompts not to guide the image generation to be sent to `tokenizer_3` and
        `text_encoder_3`. If not defined, `negative_prompt` is used in all the text-encoders.
    negative_prompt_4 (`str` or `list[str]`, *optional*):
        The prompt or prompts not to guide the image generation to be sent to `tokenizer_4` and
        `text_encoder_4`. If not defined, `negative_prompt` is used in all the text-encoders.
    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 be generated by sampling using the supplied random `generator`.
    prompt_embeds_t5 (`torch.FloatTensor`, *optional*):
        Pre-generated T5 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.
    prompt_embeds_llama3 (`torch.FloatTensor`, *optional*):
        Pre-generated LLaMA3 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_t5 (`torch.FloatTensor`, *optional*):
        Pre-generated negative T5 text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt
        weighting. If not provided, embeddings will be generated from `negative_prompt` input argument.
    negative_prompt_embeds_llama3 (`torch.FloatTensor`, *optional*):
        Pre-generated negative LLaMA3 text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt
        weighting. If not provided, embeddings will be generated from `negative_prompt` input argument.
    pooled_prompt_embeds (`torch.FloatTensor`, *optional*):
        Pre-generated pooled text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt weighting.
        If not provided, pooled text embeddings will be generated from `prompt` input argument.
    negative_pooled_prompt_embeds (`torch.FloatTensor`, *optional*):
        Pre-generated negative pooled text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt
        weighting. If not provided, pooled negative_prompt_embeds will be generated from `negative_prompt`
        input argument.
    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.flux.FluxPipelineOutput`] 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 128): Maximum sequence length to use with the `prompt`.

Examples:

Returns:
    [`~pipelines.hidream_image.HiDreamImagePipelineOutput`] or `tuple`:
    [`~pipelines.hidream_image.HiDreamImagePipelineOutput`] if `return_dict` is True, otherwise a `tuple`. When
    returning a tuple, the first element is a list with the generated. images.
r�   NÚnegative_prompt_embedszmThe `prompt_embeds` argument is deprecated. Please use `prompt_embeds_t5` and `prompt_embeds_llama3` instead.z0.35.0r   r   zˆThe `negative_prompt_embeds` argument is deprecated. Please use `negative_prompt_embeds_t5` and `negative_prompt_embeds_llama3` instead.r   )r˜   r™   rš   r›   r@   rA   rœ   r�   rB   rž   rº   FÚscale)r^   r“   r”   r•   r˜   r™   rš   r›   r—   r@   rA   rœ   r�   rB   rž   r*   r–   r_   rŸ   rŒ   r%   Úcpu)r*   r,   )Útotal)rŽ   r+   Úencoder_hidden_states_t5Úencoder_hidden_states_llama3Úpooled_embedsrÜ   )rÜ   r?   r@   rA   rB   Úlatent)rÛ   )Úimages)>Úgetr   rX   rO   ÚmathÚsqrtr¿   r»   rÇ   rÎ   rÖ   rq   rr   r¸   r6   rv   rp   rÏ   r­   r—   rw   r£   rL   rU   Úin_channelsrÃ   r`   r'   Úmax_seqÚXLA_AVAILABLEr7   r   r2   r+   r;   ÚmaxÚorderrÒ   Úprogress_barÚ	enumerater×   ÚexpandÚchunkrÉ   ÚstepÚbackendsÚmpsÚis_availabler|   ÚlocalsÚpopÚupdateÚxmÚ	mark_steprC   Úscaling_factorÚshift_factorÚdecoderW   ÚpostprocessÚmaybe_free_model_hooksr   ):r\   r^   r“   r”   r•   rÁ   rÂ   r)   r,   rÉ   r˜   r™   rš   r›   r–   r¾   r?   r@   rA   rœ   r�   rB   rž   rÛ   rÜ   rÏ   rÝ   rº   r_   r8   r�   rß   Údeprecation_messageÚdivisionÚS_maxrà   r¥   r*   rŸ   rÀ   r%   Úscheduler_kwargsÚtimestep_devicer+   Únum_warmup_stepsrð   ÚiÚtÚlatent_model_inputÚtimestepÚ
noise_predÚnoise_pred_uncondÚnoise_pred_textÚlatents_dtypeÚcallback_kwargsr³   Úcallback_outputsÚimages:                                                             r&   Ú__call__ÚHiDreamImagePipeline.__call__¢  s»  € ðP Ÿ
™
 ?°DÓ9ˆØ!'§¡Ð,DÀdÓ!KÐàÑ$ð #RÐÜ�o xÐ1DÔEØ,¨QÑ/ÐØ#0°Ñ#3Ð à!Ñ-ð #mÐÜÐ.°Ð:MÔNØ(>¸qÑ(AÐ%Ø,BÀ1Ñ,EÐ)à×K˜4×3Ñ3°d×6KÑ6KÑKˆØ×I˜×1Ñ1°D×4IÑ4IÑIˆà×(Ñ(¨1Ñ,ˆØ×)Ñ)¨D×,AÑ,AÑAÀaÑGˆØ˜™Ñ(ˆÜ—	’	˜%Ó ˆÜ˜E E™M¨XÑ5¸Ñ@ÓAÄ3ÀvÐPUÁ~ÐYaÑGaÐdlÑGlÓCmˆvð 	×ÑØØØØØ+Ø/Ø/Ø/Ø-Ø!5Ø&?Ø*GØ!5Ø*GØ/Qð 	ñ 	
ð$  .ÔØ!1ˆÔØˆŒð Ñ¤*¨V´S×"9Ñ"9Ø‰JØÑ¤J¨v´t×$<Ñ$<Ü˜V›‰JØ!Ñ-Ø-×3Ñ3°AÑ6ˆJà×'Ñ'ˆð BF×AVÑAVÑAb�T×*Ñ*×.Ñ.¨w¸Ô=Ðhlˆ
ð ×ÑØØØØØ+Ø/Ø/Ø/Ø(,×(HÑ(HØ-Ø!5Ø&?Ø*GØ!5Ø*GØØ"7Ø 3Ø!ð' ð 
ñ	
ØØ%Ø Ø)Ø Ø)ð. ×+×+Ü$ŸyšyÐ*CÐEUÐ)VÐ\]Ñ^ÐÜ#(§9¢9Ð.KÐMaÐ-bÐhiÑ#jÐ Ü#(§9¢9Ð.KÐMaÐ-bÐhiÑ#jÐ ð  $×/Ñ/×6Ñ6×BÑBÐØ×&Ñ&ØÐ.Ñ.Ø ØØØ ×&Ñ&ØØØó	
ˆô ˜T×-Ñ-×5Ñ5Ó6ˆØ  "˜:ÐßŠ=Ø#‰Oà$ˆOÜ�d—n‘nÔ&=×>Ñ>Ø�N‰N×(Ñ(Ð)<À_Ð(ÑUØŸ™×0Ñ0‰Iä-?Ø—‘Ø#Øñ.ð ð	.ð
 #ñ.Ñ*ˆIÐ*ô œs 9›~Ð0CÇnÁn×FZÑFZÑ0ZÑZÐ\]Ó^ÐÜ! )›nˆÔð ×ÑÐ%8ÐÑ9¸\Ü! )×,‘��1Ø—>—>Ùð BF×Aa×Aa¤U§Y¢Y°¨y¸1©}Ô%=ÐgnÐ"àŸ8™8Ð$6×$<Ñ$<¸QÑ$?Ó@�à!×-Ñ-Ø"4Ø&Ø-=Ø1EØ"6Ø %ð .ð ð ñ�
ð )˜[�
ð ×3×3Ø9C×9IÑ9IÈ!Ó9LÑ6Ð% Ø!2°T×5HÑ5HÈOÐ^oÑLoÑ5pÑ!p�Jð !(§¡�ØŸ.™.×-Ñ-¨j¸!¸WÐRWÐ-ÐXÐYZÑ[�à—=‘= MÓ1Ü—~‘~×)Ñ)×6Ñ6×8Ñ8à")§*¡*¨]Ó";˜à'Ñ3Ø&(�OÛ?˜Ü-3«X°a©[˜¨Ó*ñ @á';¸DÀ!ÀQÈÓ'XÐ$à.×2Ñ2°9¸gÓF�GØ'7×';Ñ';Ð<NÐP`Ó'aÐ$Ø+;×+?Ñ+?Ð@VÐXlÓ+mÐ(Ø+;×+?Ñ+?Ð@VÐXlÓ+mÐ(ð œ˜I›¨Ñ*Ó*°°A±Ð9IÓ/IÈqÐSTÉuÐX\×XfÑXf×XlÑXlÑNlÐpqÓNqØ ×'Ñ'Ô)ç •=Ü—L’L—Nñc -÷ :ðh ˜(Ó"Ø‰Eð  §¡§¡×!?Ñ!?Ñ?À4Ç8Á8Ç?Á?×C_ÑC_Ñ_ˆGà—H‘H—O‘O G¸�OÐ?ÀÑBˆEØ×(Ñ(×4Ñ4°UÈÐ4ÐTˆEð 	×#Ñ#Ô%æØ�8ˆOä)°Ñ7Ð7÷G :Õ9ús   ÎHYÖYÙ
Y")rÎ   rÇ   rÖ   rÒ   rX   rW   rO   )NrP   NN)rP   NN)NNNNNNr   TNNNNNNNNNNrP   N)NNNNNNNNNNNr    )/Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Úmodel_cpu_offload_seqr±   r   r   r   r   r	   r
   r   r   r   rR   rr   r¸   r¿   rw   r*   r`   r‚   rˆ   r‘   ÚboolÚFloatTensorÚfloatr­   r»   rÃ   ÚpropertyrÉ   r—   rÏ   rÓ   r×   Úno_gradr   ÚEXAMPLE_DOC_STRINGÚ	GeneratorÚdictr   r   r  Ú__static_attributes__Ú__classcell__)r5   s   @r&   r=   r=   Ÿ   sË  ø† ØlÐÚmÐð%Dà2ð%Dð ð%Dð 2ð	%Dð
 !ð%Dð 4ð%Dð #ð%Dð 'ð%Dð !ð%Dð )ð%Dð -ð%Dð 4÷%DðR #'Ø#&Ø&*Ø$(ñ#à�d˜3‘i‘ð#ð !ð#ð —‘˜tÑ#ð	#ð
 �{‰{˜TÑ!õ#ðT $'Ø&*Ø$(ñ#ð �d˜3‘i‘ð	#ð
 !ð#ð —‘˜tÑ#ð#ð �{‰{˜TÑ!õ#ðN #'Ø#&Ø&*Ø$(ñ*à�d˜3‘i‘ð*ð !ð*ð —‘˜tÑ#ð	*ð
 �{‰{˜TÑ!õ*ð\ *.Ø+/Ø+/Ø+/Ø&*Ø$(Ø%&Ø,0Ø26Ø48Ø48Ø48Ø;?Ø?CØDHØHLØ9=ØBFØ#&Ø#'ñ+E
à�d˜3‘i‘ $Ñ&ðE
ð ˜˜S™	‘/ DÑ(ðE
ð ˜˜S™	‘/ DÑ(ð	E
ð
 ˜˜S™	‘/ DÑ(ðE
ð —‘˜tÑ#ðE
ð �{‰{˜TÑ!ðE
ð  #ðE
ð &*ðE
ð ˜t C™y™¨4Ñ/ðE
ð   c¡™?¨TÑ1ðE
ð   c¡™?¨TÑ1ðE
ð   c¡™?¨TÑ1ðE
ð ˜u×0Ñ0Ñ1°DÑ8ðE
ð # 5×#4Ñ#4Ñ5¸Ñ<ðE
ð  $(¨×(9Ñ(9Ñ#:¸TÑ#Að!E
ð" (,¨E×,=Ñ,=Ñ'>ÀÑ'Eð#E
ð$ $×/Ñ/°$Ñ6ð%E
ð& (-×'8Ñ'8¸4Ñ'?ð'E
ð( !ð)E
ð* ˜D‘Lõ+E
ðZ ØØØØØ!Ø"&Ø&*Ø!Ø&*Ø+/ô!kðl ôð4 ñ$ó ð$ð ñ(ó ð(ð ñ&ó ð&ð ñ#ó ð#ð ñó ðð ‡]‚]ƒ_ÙÐ1Ó2ð #'Ø+/Ø+/Ø+/Ø!Ø Ø#%Ø%)Ø #Ø26Ø48Ø48Ø48Ø,-ØDHØ,0Ø59Ø9=Ø>BØBFØ9=ØBFØ"'Ø Ø26ØBFØ9B¸Ø#&ñ;I8à�d˜3‘i‘ðI8ð ˜˜S™	‘/ DÑ(ðI8ð ˜˜S™	‘/ DÑ(ð	I8ð
 ˜˜S™	‘/ DÑ(ðI8ð �d‘
ðI8ð �T‰zðI8ð !ðI8ð �U‘˜dÑ"ðI8ð ðI8ð ˜t C™y™¨4Ñ/ðI8ð   c¡™?¨TÑ1ðI8ð   c¡™?¨TÑ1ðI8ð   c¡™?¨TÑ1ðI8ð  # T™zðI8ð  —?‘? T¨%¯/©/Ñ%:Ñ:¸TÑAð!I8ð" ×"Ñ" TÑ)ð#I8ð$  ×+Ñ+¨dÑ2ð%I8ð& $×/Ñ/°$Ñ6ð'I8ð( $)×#4Ñ#4°tÑ#;ð)I8ð* (-×'8Ñ'8¸4Ñ'?ð+I8ð, $×/Ñ/°$Ñ6ð-I8ð. (-×'8Ñ'8¸4Ñ'?ð/I8ð0 ˜4‘Zð1I8ð2 ð3I8ð4 ˜s C˜x™.¨4Ñ/ð5I8ð6 '¨¨S z°4Ð'7Ñ8¸4Ñ?ð7I8ð8 -1°©Ið9I8ð: !ô;I8ó 3ó öI8r(   r=   )é   i   g      à?gffffffò?)NNNN)3r0   ré   Útypingr   r   rw   Útransformersr   r   r   r   r	   r
   rW   r   Úloadersr   Úmodelsr   r   Ú
schedulersr   r   Úutilsr   r   r   r   Úutils.torch_utilsr   Úpipeline_utilsr   Úpipeline_outputr   Útorch_xla.core.xla_modelÚcoreÚ	xla_modelrû   rí   Ú
get_loggerr  rz   r  r¿   r  r'   rr   r*   r¸   r;   r=   r!   r(   r&   Ú<module>r2     s  ðó Û ß  ã ÷÷ õ 1Ý 2ß Cß Rß ZÓ ZÝ -Ý .Ý 7ñ ×Ñß)Ð)à�Mà€Mð 
×	Ò	˜HÓ	%€ð!Ð ðN ØØØñ
àð
ð ð
ð ð	
ð
 õ
ð  '+Ø(,Ø"&Ø!%ñ8*à˜t™ð8*ð �%—,‘,Ñ Ñ%ð8*ð �C‰y˜4Ñð	8*ð
 �‰K˜$Ñõ8*ôvN8Ð,Ð.Iõ N8r(   