
    bi                     V   d dl Z d dlmZ d dlmZmZmZmZmZm	Z	m
Z
 d dlZd dlZd dlmZmZ ddlmZmZ ddlmZ ddlmZmZ dd	lmZ dd
lmZ ddlmZ ddlm Z m!Z!m"Z" ddl#m$Z$ ddl%m&Z& ddl'm(Z( ddl)m*Z*  e        rd dl+m,c m-Z. dZ/ndZ/ e!j`                  e1      Z2dZ3e G d d             Z4d*dZ5	 	 	 	 d+de6de6de7de7fdZ8	 	 	 	 d,dee6   dee
e9ejt                  f      d eee6      d!eee7      fd"Z;	 d-d#ejx                  d$eejz                     d%e9fd&Z>d.d'Z? G d( d)e(ee      Z@y)/    N)	dataclass)AnyCallableDictListOptionalTupleUnion)T5EncoderModelT5TokenizerFast   )MultiPipelineCallbacksPipelineCallback)PipelineImageInput)FromSingleFileMixinLTXVideoLoraLoaderMixin)AutoencoderKLLTXVideo)LTXVideoTransformer3DModel)FlowMatchEulerDiscreteScheduler)is_torch_xla_availableloggingreplace_example_docstring)randn_tensor)VideoProcessor   )DiffusionPipeline   )LTXPipelineOutputTFa	  
    Examples:
        ```py
        >>> import torch
        >>> from diffusers.pipelines.ltx.pipeline_ltx_condition import LTXConditionPipeline, LTXVideoCondition
        >>> from diffusers.utils import export_to_video, load_video, load_image

        >>> pipe = LTXConditionPipeline.from_pretrained("Lightricks/LTX-Video-0.9.5", torch_dtype=torch.bfloat16)
        >>> pipe.to("cuda")

        >>> # Load input image and video
        >>> video = load_video(
        ...     "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cosmos/cosmos-video2world-input-vid.mp4"
        ... )
        >>> image = load_image(
        ...     "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cosmos/cosmos-video2world-input.jpg"
        ... )

        >>> # Create conditioning objects
        >>> condition1 = LTXVideoCondition(
        ...     image=image,
        ...     frame_index=0,
        ... )
        >>> condition2 = LTXVideoCondition(
        ...     video=video,
        ...     frame_index=80,
        ... )

        >>> prompt = "The video depicts a long, straight highway stretching into the distance, flanked by metal guardrails. The road is divided into multiple lanes, with a few vehicles visible in the far distance. The surrounding landscape features dry, grassy fields on one side and rolling hills on the other. The sky is mostly clear with a few scattered clouds, suggesting a bright, sunny day. And then the camera switch to a winding mountain road covered in snow, with a single vehicle traveling along it. The road is flanked by steep, rocky cliffs and sparse vegetation. The landscape is characterized by rugged terrain and a river visible in the distance. The scene captures the solitude and beauty of a winter drive through a mountainous region."
        >>> negative_prompt = "worst quality, inconsistent motion, blurry, jittery, distorted"

        >>> # Generate video
        >>> generator = torch.Generator("cuda").manual_seed(0)
        >>> # Text-only conditioning is also supported without the need to pass `conditions`
        >>> video = pipe(
        ...     conditions=[condition1, condition2],
        ...     prompt=prompt,
        ...     negative_prompt=negative_prompt,
        ...     width=768,
        ...     height=512,
        ...     num_frames=161,
        ...     num_inference_steps=40,
        ...     generator=generator,
        ... ).frames[0]

        >>> export_to_video(video, "output.mp4", fps=24)
        ```
c                       e Zd ZU dZdZeej                  j                     ed<   dZ	ee
ej                  j                        ed<   dZeed<   dZeed<   y)	LTXVideoConditionaS  
    Defines a single frame-conditioning item for LTX Video - a single frame or a sequence of frames.

    Attributes:
        image (`PIL.Image.Image`):
            The image to condition the video on.
        video (`List[PIL.Image.Image]`):
            The video to condition the video on.
        frame_index (`int`):
            The frame index at which the image or video will conditionally effect the video generation.
        strength (`float`, defaults to `1.0`):
            The strength of the conditioning effect. A value of `1.0` means the conditioning effect is fully applied.
    Nimagevideor   frame_index      ?strength)__name__
__module____qualname____doc__r!   r   PILImage__annotations__r"   r   r#   intr%   float     i/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/diffusers/pipelines/ltx/pipeline_ltx_condition.pyr    r    _   sP     (,E8CIIOO$+-1E8D)*1KHer0   r    c                    || dz  }| dk  rt        j                  dg      S t        |      D cg c]
  }||z  |z   }}||| z  z
  }| |z
  }|||dz  z  z  }||z  d|z  |dz  z  z
  }||dz  z  }	t        ||       D cg c]  }||dz  z  ||z  z   |	z    }
}||
z   dgz   }|D cg c]  }d|z
  	 }}t        j                  |d d       S c c}w c c}w c c}w )Nr   r$   )torchtensorrange)	num_stepsthreshold_noiselinear_stepsilinear_sigma_schedulethreshold_noise_step_diffquadratic_stepsquadratic_coeflinear_coefconstquadratic_sigma_schedulesigma_schedulexs                r1   linear_quadratic_schedulerD   v   s5    A~1}||SE""IN|I\]AQ0<?]] ,/J J,.O.,RSAS2STN!L017P3PTcefTf3ggKlAo.ECHW`Ca >?!Q$+/1E9    +-EEMN'56!cAg6N6<<s+,, ^  7s   C C'Cbase_seq_lenmax_seq_len
base_shift	max_shiftc                 <    ||z
  ||z
  z  }|||z  z
  }| |z  |z   }|S Nr/   )image_seq_lenrE   rF   rG   rH   mbmus           r1   calculate_shiftrO      s;     
Z	K,$>?AQ%%A		Q	BIr0   num_inference_stepsdevice	timestepssigmasc                    ||t        d      |dt        t        j                  | j                        j
                  j                               v }|st        d| j                   d       | j                  d
||d| | j                  }t        |      }||fS |dt        t        j                  | j                        j
                  j                               v }|st        d| j                   d       | j                  d
||d| | j                  }t        |      }||fS  | j                  |fd	|i| | j                  }||fS )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 valuesrR   zThe current scheduler class zx's `set_timesteps` does not support custom timestep schedules. Please check whether you are using the correct scheduler.)rR   rQ   rS   zv's `set_timesteps` does not support custom sigmas schedules. Please check whether you are using the correct scheduler.)rS   rQ   rQ   r/   )

ValueErrorsetinspect	signatureset_timesteps
parameterskeys	__class__rR   len)	schedulerrP   rQ   rR   rS   kwargsaccepts_timestepsaccept_sigmass           r1   retrieve_timestepsrb      s   > !3tuu'3w/@/@AXAX/Y/d/d/i/i/k+ll .y/B/B.C Da b  	 	M)FMfM''	!)n ))) 
	 C(9(9):Q:Q(R(](](b(b(d$ee.y/B/B.C D_ `  	 	GvfGG''	!)n ))) 	 	 3MFMfM''	)))r0   encoder_output	generatorsample_modec                     t        | d      r |dk(  r| j                  j                  |      S t        | d      r|dk(  r| j                  j                         S t        | d      r| j                  S t        d      )Nlatent_distsampleargmaxlatentsz3Could not access latents of provided encoder_output)hasattrrg   rh   moderj   AttributeError)rc   rd   re   s      r1   retrieve_latentsrn      st     ~}-+2I))00;;		/K84K))..00		+%%%RSSr0   c                     |j                  t        t        d|j                              d      }| j                  t        t        d| j                              d      }| ||z  z  }||z  d|z
  | z  z   } | S )a  
    Rescales `noise_cfg` tensor based on `guidance_rescale` to improve image quality and fix overexposure. Based on
    Section 3.4 from [Common Diffusion Noise Schedules and Sample Steps are
    Flawed](https://huggingface.co/papers/2305.08891).

    Args:
        noise_cfg (`torch.Tensor`):
            The predicted noise tensor for the guided diffusion process.
        noise_pred_text (`torch.Tensor`):
            The predicted noise tensor for the text-guided diffusion process.
        guidance_rescale (`float`, *optional*, defaults to 0.0):
            A rescale factor applied to the noise predictions.

    Returns:
        noise_cfg (`torch.Tensor`): The rescaled noise prediction tensor.
    r   T)dimkeepdim)stdlistr6   ndim)	noise_cfgnoise_pred_textguidance_rescalestd_textstd_cfgnoise_pred_rescaleds         r1   rescale_noise_cfgr{      s    " ""tE!_5I5I,J'KUY"ZHmmU1inn%= >mMG#x''9: #66!>N:NR[9[[Ir0   c            C       .	    e Zd ZdZdZg Zg dZdedede	de
def
 fd	Z	 	 	 	 	 dgdeeee   f   dededeej&                     deej(                     f
dZ	 	 	 	 	 	 	 	 	 	 dhdeeee   f   deeeee   f      dededeej.                     deej.                     deej.                     deej.                     dedeej&                     deej(                     fdZ	 	 	 	 	 didZe	 	 	 djdedededed ed!edej&                  d"ej.                  fd#       Ze	 	 	 	 dkd%ej.                  d&ed'ed(edej&                  d"ej.                  fd)       Zedld*ej.                  d ed!ed"ej.                  fd+       Ze	 dld*ej.                  dededed ed!ed"ej.                  fd,       Ze	 dmd*ej.                  d.ej.                  d/ej.                  d0ed"ej.                  f
d1       Z e	 dmd*ej.                  d.ej.                  d/ej.                  d0ed"ej.                  f
d2       Z!d3ed4ed5efd6Z"e	 dnd7ed8ej.                  d*ej.                  d9ed:ej.                  f
d;       Z#	 	 	 	 	 	 	 	 	 	 	 	 	 	 dod?eeej.                        d@eee      dAeee      dedBededededCedDeej.                     d*eej.                     dEeejH                     deej&                     deej(                     d"e%ej.                  ej.                  ej.                  ef   fdFZ&dG Z'e(dH        Z)e(dI        Z*e(dJ        Z+e(dK        Z,e(dL        Z-e(dM        Z.e(dN        Z/ ej`                          e1e2      d
d
d
d$d-d-d
d
d<d=d>dOdPd
dQdRdSdd
d
d
d
d
d
dRd
dTdd
d
d*gdf d?ee3ee3   f   dUee4ee4   f   dVee4   d(eeee   f   dWeeee   f   dXedeeee   f   deeeee   f      dedededYedZed[ee   d\ed]ed^edee   dEeeejH                  eejH                     f      d*eej.                     deej.                     deej.                     deej.                     deej.                     d_eeee   f   d`eeeee   f      daee   dbedcee5ee6f      ddee7eee5gd
f      deee   def@df              Z8 xZ9S )pLTXConditionPipelinea  
    Pipeline for text/image/video-to-video generation.

    Reference: https://github.com/Lightricks/LTX-Video

    Args:
        transformer ([`LTXVideoTransformer3DModel`]):
            Conditional Transformer architecture to denoise the encoded video latents.
        scheduler ([`FlowMatchEulerDiscreteScheduler`]):
            A scheduler to be used in combination with `transformer` to denoise the encoded image latents.
        vae ([`AutoencoderKLLTXVideo`]):
            Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.
        text_encoder ([`T5EncoderModel`]):
            [T5](https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5EncoderModel), specifically
            the [google/t5-v1_1-xxl](https://huggingface.co/google/t5-v1_1-xxl) variant.
        tokenizer (`CLIPTokenizer`):
            Tokenizer of class
            [CLIPTokenizer](https://huggingface.co/docs/transformers/en/model_doc/clip#transformers.CLIPTokenizer).
        tokenizer (`T5TokenizerFast`):
            Second Tokenizer of class
            [T5TokenizerFast](https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5TokenizerFast).
    ztext_encoder->transformer->vae)rj   prompt_embedsnegative_prompt_embedsr^   vaetext_encoder	tokenizertransformerc                 x   t         |           | j                  |||||       t        | dd       | j                  j
                  nd| _        t        | dd       | j                  j                  nd| _        t        | dd        | j                  j                  j                  nd| _        t        | d       | j                  j                  j                  nd| _        t        | j                        | _        t        | dd       | j"                  j$                  nd	| _        d
| _        d| _        d| _        y )N)r   r   r   r   r^   r          r   r   )vae_scale_factorr           y   )super__init__register_modulesgetattrr   spatial_compression_ratiovae_spatial_compression_ratiotemporal_compression_ratiovae_temporal_compression_ratior   config
patch_sizetransformer_spatial_patch_sizepatch_size_ttransformer_temporal_patch_sizer   video_processorr   model_max_lengthtokenizer_max_lengthdefault_heightdefault_widthdefault_frames)selfr^   r   r   r   r   r\   s         r1   r   zLTXConditionPipeline.__init__  s5    	%# 	 	
 3:$t2L2XDHH..^` 	* 4;43M3YDHH//_` 	+ 3:$t2T2`D##..fg 	+ 5<D-4P4\D##00bc 	,  .t?a?ab/6t[$/O/[DNN++ad 	! " !r0   Nr      promptnum_videos_per_promptmax_sequence_lengthrQ   dtypec                    |xs | j                   }|xs | j                  j                  }t        |t              r|gn|}t        |      }| j                  |d|ddd      }|j                  }|j                  }	|	j                         j                  |      }	| j                  |dd      j                  }
|
j                  d   |j                  d   k\  rXt        j                  ||
      sB| j                  j                  |
d d |dz
  df         }t        j!                  d	| d
|        | j                  |j                  |      |	      d   }|j                  ||      }|j                  \  }}}|j#                  d|d      }|j%                  ||z  |d      }|	j%                  |d      }	|	j#                  |d      }	||	fS )N
max_lengthTpt)paddingr   
truncationadd_special_tokensreturn_tensorslongest)r   r   r3   r   zXThe following part of your input was truncated because `max_sequence_length` is set to  z	 tokens: )attention_maskr   )r   rQ   )_execution_devicer   r   
isinstancestrr]   r   	input_idsr   booltoshaper4   equalbatch_decodeloggerwarningrepeatview)r   r   r   r   rQ   r   
batch_sizetext_inputstext_input_idsprompt_attention_maskuntruncated_idsremoved_textr~   _seq_lens                  r1   _get_t5_prompt_embedsz*LTXConditionPipeline._get_t5_prompt_embeds@  s    14110**00'4&&[
nn *# % 
 %.. + : : 5 : : < ? ? G..SW.Xbb  $(<(<R(@@UcetIu>>66qJ]`aJadfJfGf7ghLNN'(	,A
 )).*;*;F*CTi)jklm%((uV(D &++7A%,,Q0EqI%**:8M+MwXZ[ 5 : ::r J 5 < <=RTU V333r0   Tnegative_promptdo_classifier_free_guidancer~   r   r   negative_prompt_attention_maskc                    |
xs | j                   }
t        |t              r|gn|}|t        |      }n|j                  d   }|| j                  |||	|
|      \  }}|r||xs d}t        |t              r||gz  n|}|:t        |      t        |      ur$t        dt        |       dt        |       d      |t        |      k7  r!t        d| dt        |       d	| d| d
	      | j                  |||	|
|      \  }}||||fS )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_videos_per_prompt (`int`, *optional*, defaults to 1):
                Number of videos 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.
            device: (`torch.device`, *optional*):
                torch device
            dtype: (`torch.dtype`, *optional*):
                torch dtype
        r   )r   r   r   rQ   r    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`.)	r   r   r   r]   r   r   type	TypeErrorrU   )r   r   r   r   r   r~   r   r   r   r   rQ   r   r   s                r1   encode_promptz"LTXConditionPipeline.encode_promptq  s   P 1411'4&&VJ&,,Q/J 373M3M&;$7 4N 40M0 '+A+I-3O@J?\_@`jO+<<fuO!d6l$:O&OUVZ[jVkUl mV~Q(  s?33 )/)::J3K_J` ax/
| <33  FJE_E_&&;$7 F` FB"$B 35KMkkkr0   c           
      T    |dz  dk7  s|	dz  dk7  rt        d| d|	 d      |
Lt         fd|
D              s8t        d j                   d|
D cg c]  }| j                  vs| c}       ||t        d	| d
| d      ||t        d      |7t        |t              s't        |t
              st        dt        |             ||t        d      ||t        d      ||~|j                  |j                  k7  r&t        d|j                   d|j                   d      |j                  |j                  k7  r&t        d|j                   d|j                   d      |||t        d      |t        |t
              r2t        |t
              r"t        |      t        |      k7  rt        d      t        |t
              r2t        |t
              r"t        |      t        |      k7  rt        d      t        |t
              r2t        |t
              r"t        |      t        |      k7  rt        d      t        |t
              r2t        |t
              r"t        |      t        |      k7  rt        d      |dk  s|dkD  rt        d|       y c c}w )Nr   r   z8`height` and `width` have to be divisible by 32 but are z and r   c              3   :   K   | ]  }|j                   v   y wrJ   )_callback_tensor_inputs).0kr   s     r1   	<genexpr>z4LTXConditionPipeline.check_inputs.<locals>.<genexpr>  s#      F
23A---F
s   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 zEMust provide `prompt_attention_mask` when specifying `prompt_embeds`.zWMust provide `negative_prompt_attention_mask` when specifying `negative_prompt_embeds`.zu`prompt_embeds` and `negative_prompt_embeds` must have the same shape when passed directly, but got: `prompt_embeds` z != `negative_prompt_embeds` z`prompt_attention_mask` and `negative_prompt_attention_mask` must have the same shape when passed directly, but got: `prompt_attention_mask` z% != `negative_prompt_attention_mask` zFIf `conditions` is provided, `image` and `video` must not be provided.zVIf `conditions` is not provided, `image` and `frame_index` must be of the same length.zSIf `conditions` is not provided, `image` and `strength` must be of the same length.zVIf `conditions` is not provided, `video` and `frame_index` must be of the same length.zSIf `conditions` is not provided, `video` and `strength` must be of the same length.r   z2The value of strength should in [0.0, 1.0] but is )	rU   allr   r   r   rs   r   r   r]   )r   r   
conditionsr!   r"   r#   r%   denoise_strengthheightwidth"callback_on_step_end_tensor_inputsr~   r   r   r   r   s   `               r1   check_inputsz!LTXConditionPipeline.check_inputs  sL   " B;!urzQWX^W__dejdkklmnn-9# F
7YF
 C
 DTEaEaDbbn  |^  pHvw  bc  ko  kG  kG  bGpq  pH  oI  J  -";08N}o ^0 0  ^ 5w  FC)@TZ\`IaQRVW]R^Q_`aa$)>)Fdee!-2P2Xvww$)?)K""&<&B&BB --:-@-@,A B.445Q8 
 %**.L.R.RR 55J5P5P4Q R6<<=Q@  !u'8E<Meff%&:k4+HSQVZ[^_j[kMk l  E4(Z$-GCPUJZ]^fZgLg !vwwE4(ZT-JsSXz]`al]mOm l  E4(Z$-GCPUJZ]^fZgLg !vwwa#3a#7QRbQcdee $8i pHs   J%%J%r   
num_framesr   r   r   r   returnc           
      j   t        j                  t        j                  d|||      t        j                  d|||      t        j                  d|||      d      }t        j                  |d      }|j	                  d      j                  | dddd      }|j                  | d||z  |z        }|S )Nr   rQ   ij)indexingrp   r   r3   )r4   meshgridarangestack	unsqueezer   reshape)	r   r   r   r   r   r   rQ   latent_sample_coordslatent_coordss	            r1   _prepare_video_idsz'LTXConditionPipeline._prepare_video_ids  s      %~~LLJVDLLFJv>LLE:f=	 
  %{{+?QG,66q9@@QPQSTVWX%--j"j6>QTY>YZr0   r   	video_idsscale_factorscale_factor_tr#   c                     | t        j                  |||g| j                        d d d d f   z  }|d d df   dz   |z
  j                  d      |d d df<   |d d dfxx   |z  cc<   |S )Nr   r   r   )min)r4   r5   rQ   clamp)r   r   r   r#   rQ   scaled_latent_coordss         r1   _scale_video_idsz%LTXConditionPipeline._scale_video_ids)  s     llNL,GPYP`P`abfhikobopq 	 ';1a4&@1&D~&U%\%\ab%\%cQT"QT"k1"##r0   rj   c           
          | j                   \  }}}}}||z  }||z  }	||z  }
| j                  |d|||	||
|      } | j                  dddddddd	      j                  dd	      j                  dd      } | S )
Nr3   r   r         r   r         )r   r   permuteflatten)rj   r   r   r   num_channelsr   r   r   post_patch_num_framespost_patch_heightpost_patch_widths              r1   _pack_latentsz"LTXConditionPipeline._pack_latents:  s     ?Fmm;
L*fe *l :"j0 J.//!	
 //!Q1aAq9AA!QGOOPQSTUr0   c           
          | j                  d      }| j                  ||||d|||      } | j                  dddddddd	      j                  dd	      j                  dd      j                  dd      } | S )
Nr   r3   r   r   r   r   r   r   r   )sizer   r   r   )rj   r   r   r   r   r   r   s          r1   _unpack_latentsz$LTXConditionPipeline._unpack_latentsR  s{     \\!_
//*j&%\[egqr//!Q1aAq9AA!QGOOPQSTU]]^_abcr0   r$   latents_meanlatents_stdscaling_factorc                     |j                  ddddd      j                  | j                  | j                        }|j                  ddddd      j                  | j                  | j                        }| |z
  |z  |z  } | S Nr   r3   r   r   rQ   r   rj   r   r  r  s       r1   _normalize_latentsz'LTXConditionPipeline._normalize_latents_  sw     $((B1a8;;GNNGMMZ!&&q"aA699'..'--X\)^;kIr0   c                     |j                  ddddd      j                  | j                  | j                        }|j                  ddddd      j                  | j                  | j                        }| |z  |z  |z   } | S r  r  r  s       r1   _denormalize_latentsz)LTXConditionPipeline._denormalize_latentsj  sw     $((B1a8;;GNNGMMZ!&&q"aA699'..'--XK'.8<Gr0   start_framesequence_num_framestarget_num_framesc                 X    | j                   }t        |||z
        }|dz
  |z  |z  dz   }|S )a  
        Trim a conditioning sequence to the allowed number of frames.

        Args:
            start_frame (int): The target frame number of the first frame in the sequence.
            sequence_num_frames (int): The number of frames in the sequence.
            target_num_frames (int): The target number of frames in the generated video.
        Returns:
            int: updated sequence length
        r   )r   r   )r   r
  r  r  r   r   s         r1   trim_conditioning_sequencez/LTXConditionPipeline.trim_conditioning_sequenceu  s@     ::,.?+.MN
 1n5DqH
r0   tinit_latentsnoise_scaleconditioning_maskc                     t        |j                  ||j                  |j                        }|d|z
  kD  j	                  d      }|||z  | dz  z  z   }	t        j                  ||	|      }|S )z
        Add timestep-dependent noise to the hard-conditioning latents. This helps with motion continuity, especially
        when conditioned on a single frame.
        rd   rQ   r   r$   r3   r   )r   r   rQ   r   r   r4   where)
r  r  rj   r  r  rd   epsnoiseneed_to_noisenoised_latentss
             r1   'add_noise_to_image_conditioning_latentsz<LTXConditionPipeline.add_noise_to_image_conditioning_latents  sp     MM>>--	
 +S3Y6AA"E%e(;q!t(DD++m^WEr0   r   r      r   condition_strengthcondition_frame_indexnum_channels_latentsnum_prefix_latent_framessigmard   c           
      `	   |dz
  | j                   z  dz   }|| j                  z  }|| j                  z  }|||||f}t        ||||      }|b|
`|j                  |k7  rt	        d|j                   d| d      |j                  ||      }|
j                  ||      }
|
|z  d|
z
  |z  z   }n|}t        |      dkD  rt        j                  ||f|t        j                        }g }g }g }d}t        |||      D ]  \  }}}t        | j                  j                  |      |      }| j                  || j                  j                  | j                  j                         j                  ||	      }|j#                  d
      }|j#                  d
      }|dk(  r;t        j$                  |d d d d d |f   ||      |d d d d d |f<   ||d d d |f<   |dkD  r||	k  rt	        d|	 d| d      ||	kD  rn|| j                   z  |	z   }||z   |	z
  } t        j$                  |d d d d || f   |d d d d |	d f   |      |d d d d || f<   ||d d || f<   |d d d d d |	f   }t        |j                  |||      }t        j$                  |||      }| j'                  ||j#                  d
      ||| j(                  | j*                  |      }!| j-                  |!| j                  | j                   ||      }!| j/                  || j(                  | j*                        }t        j0                  |j                  d d
 |||      }"|j3                  |       |j3                  |!       |j3                  |"       ||j#                  d      z  } | j'                  ||||| j*                  | j(                  |      }#t        |      dkD  rj5                  d|#d d df         }$nd\  }$}| j-                  |#| j                  | j                   d|      }#| j/                  || j(                  | j*                        }t        |      dkD  r_t              dkD  rQt        j6                  g ||d      }t        j6                  g |#d
      }#t        j6                  g |$d      }$||$|#fS )Nr   r  zLatents shape z does not match expected shape z. Please check the input.rQ   r   r   )rd   r   r   z)Number of latent frames must be at least z	 but got r   )r   r   rQ   )r   r   r#   rQ   )r   r   rQ   Nr   r   )r   r   r   r   rU   r   r]   r4   zerosfloat32ziprn   r   encoder  r   r  r   lerpr   r   r   r   r   fullappendgathercat)%r   r   r  r  r   r  r   r   r   r  r   rj   rd   rQ   r   num_latent_frameslatent_heightlatent_widthr   r  condition_latent_frames_maskextra_conditioning_latentsextra_conditioning_video_idsextra_conditioning_maskextra_conditioning_num_latentsdatar%   r#   condition_latentsnum_data_framesnum_cond_framesr
  	end_framecondition_video_idscondition_conditioning_maskr   r  s%                                        r1   prepare_latentsz$LTXConditionPipeline.prepare_latents  s   " (!^0S0SSVWW$"D"DD B BB13DmUabUieT5#4}}% $W]]O3RSXRYYrs  jjej<GHHF%H8Eemq5yG&;;GGz?Q+0;;./emm,( *,&+-(&(#-.*/2:?QSh/i @P+h$4TXX__T5JV_$`!$($;$;%txx'<'<dhh>R>R%"V5") " #'))A,"3"8"8";!#6;jj1&6&6 679JH7GAq"2?"223 IQ04D_4D1DE '**-EE","KLdKeeno~n  @A  !B#  +-EE*59\9\*\_w*wK(3o(EH`(`ICH:: '1k).C(C D 1!Q8P8Q2Q R (DGAq+i*?$?@
 V^8K	<Q9QR0A!QHaIaHaBa0b-():)@)@I^dlqrE(-

5:KX(V%*.*A*A")..q1%$#'#F#F%)%I%I% +B +' +/*?*?+%)%G%G'+'J'J$/% +@ +' )-(:(:);;<<)%
 38**)//3XfTY3/ /556GH0778KL+223NO26G6L6LQ6OO2A@PD ++==:: , 
	 z?Q < C CAyQRTUQU W@G==));;>> * 
	 $$T88$:^:^
 z?Q3'A#BQ#Fii F"< Fg FANG		"L$@"L)"LRSTI %		*W,C*WEV*W]^ _)96TTTr0   c                 t    t        t        ||z        |      }t        ||z
  d      }||d  }||d  }||||z
  fS r$  )r   r-   max)r   rS   rR   rP   r%   r7   start_indexs          r1   get_timestepsz"LTXConditionPipeline.get_timesteps-  sW    /(:;=PQ	-	91=%kl+	y"5"CCCr0   c                     | j                   S rJ   _guidance_scaler   s    r1   guidance_scalez#LTXConditionPipeline.guidance_scale4  s    ###r0   c                     | j                   S rJ   )_guidance_rescalerE  s    r1   rw   z%LTXConditionPipeline.guidance_rescale8      %%%r0   c                      | j                   dkD  S )Nr$   rC  rE  s    r1   r   z0LTXConditionPipeline.do_classifier_free_guidance<  s    ##c))r0   c                     | j                   S rJ   )_num_timestepsrE  s    r1   num_timestepsz"LTXConditionPipeline.num_timesteps@  s    """r0   c                     | j                   S rJ   )_current_timesteprE  s    r1   current_timestepz%LTXConditionPipeline.current_timestepD  rI  r0   c                     | j                   S rJ   )_attention_kwargsrE  s    r1   attention_kwargsz%LTXConditionPipeline.attention_kwargsH  rI  r0   c                     | j                   S rJ   )
_interruptrE  s    r1   	interruptzLTXConditionPipeline.interruptL  s    r0      2   r           g333333?pilr!   r"   r%   r   
frame_raterP   rR   rF  rw   image_cond_noise_scaledecode_timestepdecode_noise_scaleoutput_typereturn_dictrS  callback_on_step_endr   c!                    t        |t        t        f      r|j                  }| j	                  ||||||||	|
|||||       || _        || _        || _        d| _        d| _	        |t        |t              rd}!n-|t        |t              rt        |      }!n|j                  d   }!|xt        |t              s|g}|D "cg c]  }"|"j                   }}"|D "cg c]  }"|"j                   }}"|D "cg c]  }"|"j                    }}"|D "cg c]  }"|"j"                   }}"n||t        |t              s|g}d}#nt        |t              rt        |      }#t        |t              s|g}d}#nt        |t              rt        |      }#t        |t              s|g#z  }t        |t              s|g#z  }| j$                  }$| j&                  j(                  }%| j+                  ||| j,                  |||||| |$
      \  }}}}| j,                  r2t/        j0                  ||gd      }t/        j0                  ||gd      }g }&|duxs |du}'|'r't3        ||||      D ]  \  }(})}*}+|(>| j4                  j7                  |(|	|
      j9                  d      j;                  |$|%	      },np|)c| j4                  j=                  |)|	|
      },|,j?                  d      }-| jA                  |*|-|      }.|,ddddd|.f   },|,j;                  |$|%	      },ntC        d
      |,j?                  d      | jD                  z  dk7  r+tC        d| jD                   d|,j?                  d       d      |&jG                  |,        |dz
  | jD                  z  dz   }/|	| jH                  z  }0|
| jH                  z  }1|tK        |      }2|2dz  }tM        | jN                  ||$|      \  }}| jN                  jP                  }2tS        t        |      || jN                  jT                  z  z
  d      }3d}4|dk  r/| jW                  |2|||      \  }2}}|2dd jY                  |!|z        }4t        |      | _-        | j\                  j^                  j`                  }5| jc                  |&|||!|z  |5|	|
||4|||$t.        jd                        \  }}6}7}8|7jg                         }7|7dddf   d|z  z  |7dddf<   |'r|ji                         nd}9| j,                  rt/        j0                  |7|7gd      }7| jk                  |      5 }:tm        |      D ]  \  };}<| jn                  r|<| _	        |dkD  r|9| jq                  |<dz  |9|||6|      }| j,                  rt/        j0                  |gdz        n|}=|'r%| j,                  rt/        j0                  |6|6g      n|6}>|=j;                  |j(                        }=|<js                  |=j                  d         j9                  d      jg                         }?|'rt/        jt                  |?d>z
  dz        }?| j\                  jw                  d      5  | j]                  |=||?||7|d      d   }@ddd       | j,                  rd@jy                  d      \  }A}B|A| jz                  |B|Az
  z  z   }@|?jy                  d      \  }?}C| j|                  dkD  rt        @B| j|                        }@| jN                  j                  @ |<||?d      d   }D|'r5|<dz  dz
  d|6z
  k  j9                  d      }Et/        j                  |ED|      }nD}|Hi }F|D ]  }Gt               |G   F|G<     || |;|<F      }H|Hj                  d|      }|Hj                  d|      }|;t        |      dz
  k(  s'|;dz   |3kD  r/|;dz   | jN                  jT                  z  dk(  r|:j                          t        st        j                           	 ddd       |'r|dd|8df   }| j                  ||/|0|1| j                  | j                        }|dk(  r|}n| j                  || j&                  j                  | j&                  j                  | j&                  j^                  j                        }|j;                  |j(                        }| j&                  j^                  j                  sd}?nt        |j                  ||$|j(                        }It        |t              s|g|!z  }||}nt        |t              s|g|!z  }t/        j                  ||$|j(                        }?t/        j                  ||$|j(                        ddddddf   }d|z
  |z  |Iz  z   }| j&                  j                  ||?d      d   }| j4                  j                  ||      }| j                          |s|fS t        |       S c c}"w c c}"w c c}"w c c}"w # 1 sw Y   xY w# 1 sw Y   xY w)!u%  
        Function invoked when calling the pipeline for generation.

        Args:
            conditions (`List[LTXVideoCondition], *optional*`):
                The list of frame-conditioning items for the video generation.If not provided, conditions will be
                created using `image`, `video`, `frame_index` and `strength`.
            image (`PipelineImageInput` or `List[PipelineImageInput]`, *optional*):
                The image or images to condition the video generation. If not provided, one has to pass `video` or
                `conditions`.
            video (`List[PipelineImageInput]`, *optional*):
                The video to condition the video generation. If not provided, one has to pass `image` or `conditions`.
            frame_index (`int` or `List[int]`, *optional*):
                The frame index or frame indices at which the image or video will conditionally effect the video
                generation. If not provided, one has to pass `conditions`.
            strength (`float` or `List[float]`, *optional*):
                The strength or strengths of the conditioning effect. If not provided, one has to pass `conditions`.
            denoise_strength (`float`, defaults to `1.0`):
                The strength of the noise added to the latents for editing. Higher strength leads to more noise added
                to the latents, therefore leading to more differences between original video and generated video. This
                is useful for video-to-video editing.
            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.
            height (`int`, defaults to `512`):
                The height in pixels of the generated image. This is set to 480 by default for the best results.
            width (`int`, defaults to `704`):
                The width in pixels of the generated image. This is set to 848 by default for the best results.
            num_frames (`int`, defaults to `161`):
                The number of video frames to generate
            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`, defaults to `3 `):
                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.
            guidance_rescale (`float`, *optional*, defaults to 0.0):
                Guidance rescale factor proposed by [Common Diffusion Noise Schedules and Sample Steps are
                Flawed](https://arxiv.org/pdf/2305.08891.pdf) `guidance_scale` is defined as `φ` in equation 16. of
                [Common Diffusion Noise Schedules and Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf).
                Guidance rescale factor should fix overexposure when using zero terminal SNR.
            num_videos_per_prompt (`int`, *optional*, defaults to 1):
                The number of videos 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.Tensor`, *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.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.
            prompt_attention_mask (`torch.Tensor`, *optional*):
                Pre-generated attention mask for text embeddings.
            negative_prompt_embeds (`torch.FloatTensor`, *optional*):
                Pre-generated negative text embeddings. For PixArt-Sigma this negative prompt should be "". If not
                provided, negative_prompt_embeds will be generated from `negative_prompt` input argument.
            negative_prompt_attention_mask (`torch.FloatTensor`, *optional*):
                Pre-generated attention mask for negative text embeddings.
            decode_timestep (`float`, defaults to `0.0`):
                The timestep at which generated video is decoded.
            decode_noise_scale (`float`, defaults to `None`):
                The interpolation factor between random noise and denoised latents at the decode timestep.
            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.ltx.LTXPipelineOutput`] 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.ltx.LTXPipelineOutput`] or `tuple`:
                If `return_dict` is `True`, [`~pipelines.ltx.LTXPipelineOutput`] is returned, otherwise a `tuple` is
                returned where the first element is a list with the generated images.
        )r   r   r!   r"   r#   r%   r   r   r   r   r~   r   r   r   FNr   r   )
r   r   r   r   r~   r   r   r   r   rQ   r   r   r#  z<Either `image` or `video` must be provided for conditioning.z7Number of frames in the video must be of the form (k * z + 1) but got z frames.i  )
r   r  r   r   r   r   rj   rd   rQ   r   r$   )totalg     @@r3   cond_uncond)hidden_statesencoder_hidden_statestimestepencoder_attention_maskvideo_coordsrS  r`  )rw   )per_token_timestepsr`  ư>rj   r~   latentr  r"  )r`  )r_  )frames)Vr   r   r   tensor_inputsr   rD  rH  rR  rU  rO  r   rs   r]   r   r%   r#   r!   r"   r   r   r   r   r   r4   r-  r'  r   
preprocessr   r   preprocess_videor   r  rU   r   r+  r   rD   rb   r^   rS   r?  orderrA  r   rL  r   r   in_channelsr=  r&  r.   cloneprogress_bar	enumeraterV  r  expandr   cache_contextchunkrF  rw   r{   stepr  localspopupdateXLA_AVAILABLExm	mark_stepr   r   r   r	  r   r  r  timestep_conditioningr   r5   decodepostprocess_videomaybe_free_model_hooksr   )Jr   r   r!   r"   r#   r%   r   r   r   r   r   r   r[  rP   rR   rF  rw   r\  r   rd   rj   r~   r   r   r   r]  r^  r_  r`  rS  ra  r   r   r   	conditionnum_conditionsrQ   	vae_dtypeconditioning_tensorsis_conditioning_image_or_videocondition_imagecondition_videor  r  condition_tensornum_frames_inputnum_frames_outputlatent_num_framesr/  r0  rS   num_warmup_stepslatent_sigmar  r  ri  r5  r  rt  r:   r  latent_model_inputconditioning_mask_model_inputrg  
noise_prednoise_pred_uncondrv   r   denoised_latentstokens_to_denoise_maskcallback_kwargsr   callback_outputsr  sJ                                                                             r1   __call__zLTXConditionPipeline.__call__P  s
   R *-=?U,VW1E1S1S. 	!#-/Q'#9"7+I 	 	
"  .!1!1!% *VS"9JJvt$<VJ&,,Q/J!j$/(\
<FGy	**GHGBLMY900MKM6@AY__AEA6@AY__AEA%"3eT*!"E4(!$UeT*!"E4(!$Uk40*mn<h-$:6''HHNN	 +(,(H(H"7'#9"7+I 3  
	
!"* ++!II'=}&MSTUM$)II/MOd.ekl$m!!).d):)Oe4>O&)_buk8` >[2GI[ #.,,77QVW"1F)4 %
 %0'+';';'L'L_^dfk'l$'7'<'<Q'?$(,(G(G-/?)% (81>P?P>P8P'Q$'7':':6':'S$$%cdd#((+d.Q.QQUVV$QRVRuRuQv w##3#8#8#;"<HF  %++,<=3>8 (!^0S0SSVWW$"D"DD B BB./BCFI);DNNL_agir)s&	&&&s9~0CdnnFZFZ0ZZ\]^a595G5G	#68H62FI2 ""1:,,Z:O-OPL!)n  $//66BBSWSgSg !$99!5!-- Th T
P"L2P  $))+)!Q$/33CDQT*Hw}}d++ 99lL%AqIL %89 N	#\!), M#1>>)*&)A-,2J #JJF
$.)!G BFAaAaUYYy1}%=gn"1  ;; 		#46G"HI. 2
 &8%:%:=;N;N%O" 88$6$<$<Q$?@JJ2NTTV1$yyA8U4UY_3_`H%%33MB 	!%!1!1&8.;!)/D%1)9$) "2 " "J	 339C9I9I!9L6%!2T5H5HO^oLo5p!pJ"*.."3KHa,,q0%6&$J_J_&
 $(>>#6#6KGW\ $7 $$  2./$hoGXAX.Y-d-deg-h*#kk*@BRT[\G.G'3&(O? 9-3Xa[*9';D!Q'X$.229gFG$4$8$8-$XM I**A9I/IqSTuX\XfXfXlXlNlpqNq '') LLN[M#N	#` *a!?!@@AG&&//00
 ("E//..0D0DdhhooFdFdG jj!4!45G88??88$W]]iPV^e^k^kl!/48'6&7*&DO%-)8&#$6=*<)=
)J& <<gmm\%*\\2DV[b[h[h%itT4-&" 11W<?QTY?YYHHOOGX5OI!LE((::5k:ZE 	##%8O ..s HMAAr	 	CN	# N	#sD    gg2g#g(#D$g:g-#E-g:g:-g72g::h)Nr   r   NN)
NTr   NNNNr   NN)NNNNN)r   r   N)r   r   r   N)r   r   )r$   )rk  )NNNr   r   r   r   r  r   NNNNN):r&   r'   r(   r)   model_cpu_offload_seq_optional_componentsr   r   r   r   r   r   r   r
   r   r   r-   r   r4   rQ   r   r   r   Tensorr   r   staticmethodr   r   r   r   r.   r  r	  r  r  	Generatorr	   r=  rA  propertyrF  rw   r   rM  rP  rS  rV  no_gradr   EXAMPLE_DOC_STRINGr    r   r   r   r   r  __classcell__)r\   s   @r1   r}   r}      s)	   . =T&"2&" #&" %	&"
 #&" 0&"T )-%&#&)-'+.4c49n%.4  #.4 !	.4
 &.4 $.4h <@,0%&049=8<AE#&)-'+Qlc49n%Ql "%T#Y"78Ql &*	Ql
  #Ql  -Ql !) 6Ql  (5Ql )1(>Ql !Ql &Ql $Ql| ,0#"'+Mf^  #  	
    
 *  #$<<$$ $ 	$
 $ 
$ $  u||  PS \a\h\h  ,  st		+.	8;	DG	UX	lo			 	  or-2\\HMfk	   or-2\\HMfk	 c PS hk "  ll  	
 !<< 6 484859$'()(,*./3)-'+KUT%,,/0KU %T%[1KU  (S	2	KU
 KU "KU KU KU KU #&KU %KU %,,'KU EOO,KU &KU $KU  
u||U\\5<<<	=!KUZD $ $ & & * * # # & & & &   U]]_12 IMEI*.-..1"%(,;?#%# !"%(,/0MQ*.048<9=AE58BF%* 59KO9B#&Cg/+T2C-DDEg/ '.@)AABg/ &'	g/
 3S	>*g/ tE{*+g/  g/ c49n%g/ "%T#Y"78g/ g/ g/ g/ g/ !g/ 9g/  !g/"  #g/$ !&%g/&  (}'g/( E%//43H"HIJ)g/* %,,'+g/,  --g/.  (5/g/0 !) 61g/2 )1(>3g/4 ud5k125g/6 %U5$u++=%>?7g/8 c]9g/: ;g/< #4S>2=g/> 'xc40@$0F'GH?g/@ -1IAg/B !Cg/ 3 g/r0   r}   )g?N)r   i   g      ?gffffff?)NNNN)Nrh   )rY  )ArW   dataclassesr   typingr   r   r   r   r   r	   r
   	PIL.Imager*   r4   transformersr   r   	callbacksr   r   image_processorr   loadersr   r   models.autoencodersr   models.transformersr   
schedulersr   utilsr   r   r   utils.torch_utilsr   r   r   pipeline_utilsr   pipeline_outputr   torch_xla.core.xla_modelcore	xla_modelr~  r}  
get_loggerr&   r   r  r    rD   r-   r.   rO   r   rQ   rb   r  r  rn   r{   r}   r/   r0   r1   <module>r     s    ! D D D   8 A 1 C 8 = 9 O O - - . . ))MM			H	%/ d   ,-, 

 
 	

 
  *.15%)$(8*!#8* U3,-.8* S	"	8*
 T%[!8*z ck
TLL
T-5eoo-F
T\_
T4}/,.ACZ }/r0   