
    
3j_m              
          S SK r S SKJrJr  S SKrS SK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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\R@                  " \!5      r"Sr#Sr$    SS\%S\%S\&S\&4S jjr'    SS\%S-  S\(\RR                  -  S-  S\*\%   S-  S\*\&   S-  4S jjr+ " S S\5      r,g)     N)AnyCallable)Qwen3VLForConditionalGenerationQwen3VLProcessor   )VaeImageProcessor)AutoencoderKLQwenImage!NucleusMoEImageTransformer2DModel)FlowMatchEulerDiscreteScheduler)is_torch_xla_availableloggingreplace_example_docstring)randn_tensor   )DiffusionPipeline   )NucleusMoEImagePipelineOutputTFa  You are an image generation assistant. Follow the user's prompt literally. Pay careful attention to spatial layout: objects described as on the left must appear on the left, on the right on the right. Match exact object counts and assign colors to the correct objects.a  
    Examples:
        ```py
        >>> import torch
        >>> from diffusers import NucleusMoEImagePipeline

        >>> pipe = NucleusMoEImagePipeline.from_pretrained("NucleusAI/NucleusMoE-Image", torch_dtype=torch.bfloat16)
        >>> pipe.to("cuda")
        >>> prompt = "A cat holding a sign that says hello world"
        >>> image = pipe(prompt, num_inference_steps=50).images[0]
        >>> image.save("nucleus_moe.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           x/home/wildlama/miniconda3/lib/python3.13/site-packages/diffusers/pipelines/nucleusmoe_image/pipeline_nucleusmoe_image.pycalculate_shiftr    ;   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_timestepsr4   I   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''	))r!   c            .         ^  \ rS rSrSrSrSS/rS\S\S\	S	\
S
\4
U 4S jjrS5S\S\S-  S\4S jjr       S6S\\\   -  S\R"                  S-  S\S\R&                  S-  S\R&                  S-  S\S-  S\S-  4S jjr        S7S jr\S 5       r\S 5       r S5S jr\S 5       r\S 5       r\S 5       r\S 5       r\S  5       r\R@                  " 5       \!" \"5      SSS!SSS"SSSSSSSSSSS#S$SSS/4S\\\   -  S%\\\   -  S&\#S'\S-  S(\S-  S)\S*\\#   S-  S\S\S-  S\S-  S+\RH                  \\RH                     -  S-  S\R&                  S-  S\R&                  S-  S\R&                  S-  S,\R&                  S-  S-\R&                  S-  S.\S-  S/\%S0\&\\'4   S-  S1\(\\\&/S4   S-  S2\\   4*S3 jj5       5       r)S4r*U =r+$ )8NucleusMoEImagePipeline   at  
Pipeline for text-to-image generation using NucleusMoE.

This pipeline uses a single-stream DiT with Mixture-of-Experts feed-forward layers, cross-attention to a Qwen3-VL
text encoder, and a flow-matching Euler discrete scheduler.

Args:
    transformer ([`NucleusMoEImageTransformer2DModel`]):
        Conditional Transformer (MMDiT) architecture to denoise the encoded image latents.
    scheduler ([`FlowMatchEulerDiscreteScheduler`]):
        A scheduler to be used in combination with `transformer` to denoise the encoded image latents.
    vae ([`AutoencoderKLQwenImage`]):
        Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.
    text_encoder ([`Qwen3VLForConditionalGeneration`]):
        Text encoder for computing prompt embeddings.
    processor ([`Qwen3VLProcessor`]):
        Processor for tokenizing text inputs.
ztext_encoder->transformer->vaelatentsprompt_embedstransformerr0   vaetext_encoder	processorc                   > [         TU ]  5         U R                  UUUUUS9  [        U SS 5      (       a"  S[	        U R
                  R                  5      -  OSU l        [        U R                  S-  S9U l	        SU l
        SU l        SU l        g )	N)r:   r0   r;   r<   r=   r;   r      )vae_scale_factor   i   i)super__init__register_modulesgetattrr/   r;   temperal_downsampler@   r   image_processordefault_sample_sizedefault_max_sequence_lengthdefault_return_index)selfr:   r0   r;   r<   r=   r.   s         r   rC    NucleusMoEImagePipeline.__init__   s     	#% 	 	
 KRRVX]_cJdJdS)E)E%F Fjk0$BWBWZ[B[\#& +/($&!r!   Npromptsystem_promptreturnc                 f    Uc  [         nSUS.SSUS./S./nU R                  R                  USSS9$ )	Nsystem)rolecontentusertext)typerU   FT)tokenizeadd_generation_prompt)DEFAULT_SYSTEM_PROMPTr=   apply_chat_template)rK   rM   rN   messagess       r   _format_prompt&NucleusMoEImagePipeline._format_prompt   sK     1M-8&&)I(JK
 ~~11(Ubf1ggr!   r   r#   num_images_per_promptprompt_embeds_maskmax_sequence_lengthreturn_indexc           
         U=(       d    U R                   nU=(       d    U R                  nUc  [        U[        5      (       a  U/OUnU Vs/ s H  oR	                  U5      PM     n	nU R                  U	SSUSSSS9R                  US9n
U
R                  nU R                  " S0 U
DSSSS	.D6nUR                  U   nUR                  U R                  R                  US
9nO!UR                  US9nUb  UR                  US9nUS:  a#  UR                  USS9nUb  UR                  USS9nUb  UR                  5       (       a  SnXE4$ s  snf )a  
Encode text prompt(s) into embeddings using the Qwen3-VL text encoder.

Args:
    prompt (`str` or `list[str]`, *optional*):
        The prompt or prompts to encode.
    device (`torch.device`, *optional*):
        Torch device for the resulting tensors.
    num_images_per_prompt (`int`, defaults to 1):
        Number of images to generate per prompt.
    prompt_embeds (`torch.Tensor`, *optional*):
        Pre-generated text embeddings. Skips encoding when provided.
    prompt_embeds_mask (`torch.Tensor`, *optional*):
        Attention mask for pre-generated embeddings.
    max_sequence_length (`int`, defaults to 1024):
        Maximum token length for the encoded prompt.
Nlongestr?   Tpt)rU   paddingpad_to_multiple_of
max_length
truncationreturn_attention_maskreturn_tensors)r#   F)	use_cachereturn_dictoutput_hidden_states)dtyper#   r   r   )dimr   )_execution_devicerJ   
isinstancestrr\   r=   toattention_maskr<   hidden_statesrn   repeat_interleaveall)rK   rM   r#   r^   r9   r_   r`   ra   p	formattedinputsoutputss               r   encode_prompt%NucleusMoEImagePipeline.encode_prompt   s   6 1411#@t'@'@ !+FC!8!8fXfF9?@A,,Q/I@^^!#$.&*# $  bb  "(!6!6''o&oEtjnoG#11,?M),,43D3D3J3JSY,ZM),,F,;M!-%7%:%:&%:%I" 1$);;<QWX;YM!-%7%I%IJ_ef%I%g").@.D.D.F.F!%00= As   E	c           
      Z  ^  UT R                   S-  -  S:w  d  UT R                   S-  -  S:w  a,  [        R                  ST R                   S-   SU SU S35        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b2  [        U[        [        45      (       d  [	        S[        U5       35      eUb  Ub  [	        SU SU S35      eUbz  [        U5      T R                  R                  R                  R                  :  aB  [	        ST R                  R                  R                  R                   S[        U5       35      eg g s  snf )Nr   r   z-`height` and `width` have to be divisible by z	 but are z and z(. Dimensions will be resized accordinglyc              3   @   >#    U  H  oTR                   ;   v   M     g 7fr   )_callback_tensor_inputs).0krK   s     r   	<genexpr>7NucleusMoEImagePipeline.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.zHProvide either `prompt` or `prompt_embeds`. Cannot leave both undefined.z2`prompt` has to be of type `str` or `list` but is z'Cannot forward both `negative_prompt`: z and `negative_prompt_embeds`: z.absolute value of `return_index` cannot be >= z but is )r@   loggerwarningrw   r'   r   rq   rr   listrV   absr<   configtext_confignum_hidden_layers)rK   rM   heightwidthnegative_promptr9   r_   negative_prompt_embedsnegative_prompt_embeds_mask"callback_on_step_end_tensor_inputsr`   ra   r   s   `            r   check_inputs$NucleusMoEImagePipeline.check_inputs   s    T**Q./14AVAVYZAZ8[_`8`NN?@U@UXY@Y?Z [!(%w.VX
 .9# F
7YF
 C
 C
 DTEaEaDb c)Ku)KAX\XtXtOta)Kuvx 
 -";08N}o ^C C  ^ 5ghh
6C;(G(GQRVW]R^Q_`aa&+A+M9/9J K--C,D ECC  #L(9T=N=N=U=U=a=a=s=s(s@ARARAYAYAeAeAwAw@x yl+,.  )t#) vs   F(%F(c                     U R                  XX5-  XTU-  U5      n U R                  SSSSSS5      n U R                  XU-  XE-  -  X%-  U-  5      n U $ )Nr   r      r   r      )viewpermutereshape)r8   
batch_sizenum_channels_latentsr   r   
patch_sizes         r   _pack_latents%NucleusMoEImagePipeline._pack_latents.  sn    ,,f.BJYcPceo
 //!Q1a3//:-%2EFH\HilvHv
 r!   c                 
   U R                   u  pVnU[        U5      XC-  -  -  nU[        U5      XC-  -  -  nU R                  UX-  X#-  XsU-  -  UU5      n U R                  SSSSSS5      n U R	                  XWX3-  -  SX5      n U $ )Nr   r   r   r   r   r   )shapeintr   r   r   )r8   r   r   r   r@   r   num_patcheschannelss           r   _unpack_latents'NucleusMoEImagePipeline._unpack_latents9  s    ,3MM)
s6{/?/LMNc%j-=-JKL,, j01
 //!Q1a3//*:;R.SUVX^fr!   c
                 f   U[        U5      U R                  U-  -  -  nU[        U5      U R                  U-  -  -  nUSX$U4n
U	b  U	R                  XvS9$ [        U[        5      (       a*  [        U5      U:w  a  [        S[        U5       SU S35      e[        XXvS9n	U R                  XX$XS5      n	U	$ )Nr   )r#   rn   z/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#   rn   )	r   r@   rs   rq   r   r/   r'   r   r   )rK   r   r   r   r   r   rn   r#   r   r8   r   s              r   prepare_latents'NucleusMoEImagePipeline.prepare_latentsJ  s     s6{t/D/Dz/QRSc%jT-B-BZ-OPQQ 4eD::V:99i&&3y>Z+GA#i.AQ R&<'gi 
 u&V$$W:NX]jr!   c                     U R                   $ r   )_guidance_scalerK   s    r   guidance_scale&NucleusMoEImagePipeline.guidance_scaleg  s    ###r!   c                     U R                   $ r   )_attention_kwargsr   s    r   attention_kwargs(NucleusMoEImagePipeline.attention_kwargsk      %%%r!   c                     U R                   $ r   )_num_timestepsr   s    r   num_timesteps%NucleusMoEImagePipeline.num_timestepso  s    """r!   c                     U R                   $ r   )_current_timestepr   s    r   current_timestep(NucleusMoEImagePipeline.current_timesteps  r   r!   c                     U R                   $ r   )
_interruptr   s    r   	interrupt!NucleusMoEImagePipeline.interruptw  s    r!   g      @2   pilTr   r   r   r   r"   r%   r   r   r   output_typerl   r   callback_on_step_endr   c                    U=(       d    U R                   U R                  -  nU=(       d    U R                   U R                  -  nU	=(       d    U R                  n	U R                  UUUUUUUUUU	U
S9  X0l        U=(       d    0 U l        SU l        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L=(       d    USL=(       a    USLnUS:  nU(       a  U(       d  S/U-  nU R                  UUUUUU	U
S9u  pU(       a  U R                  UUUUUU	U
S9u  nnU R                  R                   R"                  S-  nU R                  R                   R$                  nU R'                  UU-  UUUUUR(                  UUU5	      nSX@R                  -  U-  XPR                  -  U-  4/UU-  -  nUc  [*        R,                  " S	SU-  U5      OUnUR                  S   n[/        UU R0                  R                   R3                  S
S5      U R0                  R                   R3                  SS5      U R0                  R                   R3                  SS5      U R0                  R                   R3                  SS5      5      n[5        U R0                  UUUUS9u  nn[7        [        U5      X`R0                  R8                  -  -
  S5      n [        U5      U l        U R0                  R=                  S5        U R                  R>                  (       a  U R                  RA                  5         U RC                  US9 n![E        U5       GH[  u  n"n#U RF                  (       a  M  U#U l        U#RI                  UR                  S   5      RK                  UR(                  5      n$U R                  UU$U R0                  R                   RL                  -  UUUU R
                  SS9S   n%U(       a  U R                  UU$U R0                  R                   RL                  -  UUUU R
                  SS9S   n&U&UU%U&-
  -  -   n'[N        RP                  " U%SSS9n([N        RP                  " U'SSS9n)U'U(U)-  -  n%U%* n%UR(                  n*U R0                  RS                  U%U#USS9S   nUR(                  U*:w  a>  [N        RT                  RV                  RY                  5       (       a  URK                  U*5      nUbJ  0 n+U H  n,[[        5       U,   U+U,'   M     U" U U"U#U+5      n-U-R]                  SU5      nU-R]                  SU5      nU"[        U5      S-
  :X  d)  U"S-   U :  a0  U"S-   U R0                  R8                  -  S:X  a  U!R_                  5         [`        (       d  GMF  [b        Rd                  " 5         GM^     SSS5        SU l        US:X  a  Un.GOU Rg                  XUUU R                  5      nURK                  U Rh                  R(                  5      n[N        Rj                  " U Rh                  R                   Rl                  5      Ro                  SU Rh                  R                   Rp                  SSS5      RK                  URr                  UR(                  5      n/S	[N        Rj                  " U Rh                  R                   Rt                  5      Ro                  SU Rh                  R                   Rp                  SSS5      RK                  URr                  UR(                  5      -  n0UU0-  U/-   nU Rh                  Rw                  USS9S   SS2SS2S4   n.U Rx                  R{                  U.US9n.U R}                  5         U(       d  U.4$ [        U.S9$ ! , (       d  f       GN= f)a4  
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, an empty string is used when
        `true_cfg_scale > 1`.
    true_cfg_scale (`float`, *optional*, defaults to 4.0):
        Classifier-free guidance scale. Values greater than 1 enable CFG.
    height (`int`, *optional*, defaults to `self.default_sample_size * self.vae_scale_factor`):
        The height in pixels of the generated image.
    width (`int`, *optional*, defaults to `self.default_sample_size * self.vae_scale_factor`):
        The width in pixels of the generated image.
    num_inference_steps (`int`, *optional*, defaults to 50):
        The number of denoising steps.
    sigmas (`list[float]`, *optional*):
        Custom sigmas for the denoising schedule. If not defined, a linear schedule is used.
    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 generators to make generation deterministic.
    latents (`torch.Tensor`, *optional*):
        Pre-generated noisy latents to be used as inputs for image generation.
    prompt_embeds (`torch.Tensor`, *optional*):
        Pre-generated text embeddings.
    prompt_embeds_mask (`torch.Tensor`, *optional*):
        Attention mask for pre-generated text embeddings.
    negative_prompt_embeds (`torch.Tensor`, *optional*):
        Pre-generated negative text embeddings.
    negative_prompt_embeds_mask (`torch.Tensor`, *optional*):
        Attention mask for pre-generated negative text embeddings.
    output_type (`str`, *optional*, defaults to `"pil"`):
        The output format of the generated image. Choose between `"pil"`, `"np"`, or `"latent"`.
    return_dict (`bool`, *optional*, defaults to `True`):
        Whether or not to return a [`NucleusMoEImagePipelineOutput`] instead of a plain tuple.
    attention_kwargs (`dict`, *optional*):
        Kwargs passed to the attention processor.
    callback_on_step_end (`Callable`, *optional*):
        A function called at the end of each denoising step.
    callback_on_step_end_tensor_inputs (`list`, *optional*):
        Tensor inputs for the `callback_on_step_end` function.
    max_sequence_length (`int`, defaults to 512):
        Maximum sequence length for the text prompt.

Examples:

Returns:
    [`NucleusMoEImagePipelineOutput`] or `tuple`:
        [`NucleusMoEImagePipelineOutput`] if `return_dict` is True, otherwise a `tuple` where the first element
        is a list with the generated images.
)r   r9   r_   r   r   r   r`   ra   NFr   r    )rM   r9   r_   r#   r^   r`   ra   r   g      ?base_image_seq_len   max_image_seq_len   r         ?r   ffffff?)r%   r   )total)ru   timestepencoder_hidden_statesencoder_hidden_states_mask
img_shapesr   rl   T)ro   keepdim)rl   r8   r9   latent)r   )images)@rH   r@   rI   r   r   r   r   r   rq   rr   r   r/   r   rp   r|   r:   r   in_channelsr   r   rn   nplinspacer    r0   getr4   maxorderr   set_begin_indexis_cache_enabled_reset_stateful_cacheprogress_bar	enumerater   expandrs   num_train_timestepstorchnormstepbackendsmpsis_availablelocalspopupdateXLA_AVAILABLExm	mark_stepr   r;   tensorlatents_meanr   z_dimr#   latents_stddecoderG   postprocessmaybe_free_model_hooksr   )1rK   rM   r   r   r   r   r"   r%   r^   r`   ra   r   r8   r9   r_   r   r   r   rl   r   r   r   r   r#   has_neg_promptdo_cfgr   r   r   r   r   r$   num_warmup_stepsr   itr   
noise_predneg_noise_pred	comb_pred	cond_norm
noise_normlatents_dtypecallback_kwargsr   callback_outputsimager   r   s1                                                    r   __call__ NucleusMoEImagePipeline.__call__{  sd   ` K433d6K6KKI11D4I4II1UT5U5U+'1#9(C/Q 3% 	 	
  .!1!7R!%*VS"9"9JJvt$<$<VJ&,,Q/J''(4 
"$.Z3NVZ3Z 	  !#.!dZ/O,0,>,>'1"7 3% -? -
) BFBTBT&4#>&;$7) CU C?"$?  $//66BBaG%%,,77
&&.. 

 ///:=uH]H]?]ak?kl
//1
 TZSaS!&9"9;NOgma(NN!!%%&:C@NN!!%%&94@NN!!%%lC8NN!!%%k48
 *<NN*
&	& s9~0CnnFZFZ0ZZ\]^!)n&&q),,224%89\!),1>>)*&88GMM!$4588G!--")%(=(=(Q(QQ*7/A)%)%;%; % .  
 %)%5%5&-!)DNN,A,A,U,U!U.D3N#-)-)?)?$) &6 & &N !/:P^C^1_ _I %

:2t LI!&I2t!LJ!*i*.D!EJ([
 '..--j!WRW-XYZ[==M1~~))6688")**]";'3&(O?-3Xa[* @';D!Q'X$.229gFG$4$8$8-$XMI**A9I/IqSTuX\XfXfXlXlNlpqNq '') =LLNm - :r "&("E**7E:tOdOdeGjj0GTXX__99:a..1a8GNNGMM2 
 TXX__-H-H I N NqRVRZRZRaRaRgRgijlmop q t t! K +l:GHHOOGO?B1a7KE((44U4TE##%8O,E::c :9s   2I^;^;;
_
)
r   r   r   r   r   rI   rJ   rH   rG   r@   r   )NNr   NNNN)NNNNNNNN),__name__
__module____qualname____firstlineno____doc__model_cpu_offload_seqr   r
   r   r	   r   r   rC   rr   r\   r   r   r#   r   Tensorr|   r   staticmethodr   r   r   propertyr   r   r   r   r   no_gradr   EXAMPLE_DOC_STRINGfloat	Generatorbooldictr   r   r  __static_attributes____classcell__)r.   s   @r   r6   r6      s   & =(/:'6' 3' $	'
 6' $'.hS ht hs h #'&*%&-126*.#'>1d3i>1 t#>1  #	>1
 ||d*>1 "LL4/>1 !4Z>1 Dj>1J #$(+/ 1f    4 : $ $ & & # # & &   ]]_12 #'+/ #! #%%)%&*.#'DH'+-1266:;?"' 26HL9B-G;d3iG; tCyG; 	G;
 d
G; TzG; !G; Ud"G;  #G; !4ZG; DjG; ??T%//%::TAG; $G; ||d*G; "LL4/G;  !&t 3!G;" &+\\D%8#G;$ 4Z%G;& 'G;( sCx.4/)G;* 'S$'7'=>E+G;, -1I-G; 3 G;r!   r6   )r   r   r   r   )NNNN)-r)   typingr   r   numpyr   r   transformersr   r   rG   r   modelsr	   r
   
schedulersr   utilsr   r   r   utils.torch_utilsr   pipeline_utilsr   pipeline_outputr   torch_xla.core.xla_modelcore	xla_modelr   r   
get_loggerr  r   rY   r  r   r  r    rr   r#   r   r4   r6   r   r!   r   <module>r#     s        J 0 O 9 O O - . : ))MM 
		H	% g  $ 

 
 	

 
  '+(,"&!%8*t8* %,,%8* Cy4	8*
 K$8*v@;/ @;r!   