#
# Được cấp phép theo Giấy phép Apache, Phiên bản 2.0 (gọi là "Giấy phép");
# bạn có thể không sử dụng tệp này ngoại trừ tuân thủ theo Giấy phép.
# Bạn có thể nhận được một bản sao của Giấy phép tại
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Trừ khi được yêu cầu bởi luật pháp có hiệu lực hoặc được thỏa thuận bằng văn bản, phần mềm
# được phân phối theo Giấy phép được phân phối trên cơ sở
# KHÔNG CÓ BẢO HÀNH HOẶC ĐIỀU KIỆN DƯỚI BẤT KỲ HÌNH THỨC NÀO, dù được nêu rõ hay ngụ ý.
# Xem Giấy phép để biết ngôn ngữ cụ thể điều chỉnh các quyền và
# giới hạn theo Giấy phép. -->

  
    
      
    
    
  

# LTX-Video

[LTX-Video](https://huggingface.co/Lightricks/LTX-Video) là một diffusion transformer được thiết kế để tạo video độ phân giải cao từ văn bản và hình ảnh một cách nhanh chóng và theo thời gian thực. Tính năng chính của LTX-Video là Video-VAE. Video-VAE có tỷ lệ nén từ pixel sang latent cao hơn (1:192), cho phép xử lý dữ liệu video hiệu quả hơn và tốc độ tạo nhanh hơn. Để hỗ trợ và ngăn chặn việc mất các chi tiết tinh tế trong quá trình tạo, bộ giải mã Video-VAE thực hiện việc chuyển đổi từ latent sang pixel *và* bước khử nhiễu cuối cùng.

Bạn có thể tìm thấy tất cả các checkpoint gốc của LTX-Video dưới tổ chức [Lightricks](https://huggingface.co/Lightricks).

> [!TIP]
> Nhấp vào các mô hình LTX-Video ở thanh bên phải để xem thêm các ví dụ về các tác vụ tạo video khác.

Ví dụ dưới đây minh họa cách tạo video được tối ưu hóa cho bộ nhớ hoặc tốc độ suy luận.

Tham khảo hướng dẫn [Giảm mức sử dụng bộ nhớ](../../optimization/memory) để biết thêm chi tiết về các kỹ thuật tiết kiệm bộ nhớ khác nhau.

Mô hình LTX-Video bên dưới yêu cầu ~10GB VRAM.

```py
import torch
from diffusers import LTXPipeline, AutoModel
from diffusers.hooks import apply_group_offloading
from diffusers.utils import export_to_video

# fp8 layerwise weight-casting
transformer = AutoModel.from_pretrained(
    "Lightricks/LTX-Video",
    subfolder="transformer",
    dtype=torch.bfloat16
)
transformer.enable_layerwise_casting(
    storage_dtype=torch.float8_e4m3fn, compute_dtype=torch.bfloat16
)

pipeline = LTXPipeline.from_pretrained("Lightricks/LTX-Video", transformer=transformer, dtype=torch.bfloat16)

# group-offloading
onload_device = torch.device("cuda")
offload_device = torch.device("cpu")
pipeline.transformer.enable_group_offload(onload_device=onload_device, offload_device=offload_device, offload_type="leaf_level", use_stream=True)
apply_group_offloading(pipeline.text_encoder, onload_device=onload_device, offload_type="block_level", num_blocks_per_group=2)
apply_group_offloading(pipeline.vae, onload_device=onload_device, offload_type="leaf_level")

prompt = """
A woman with long brown hair and light skin smiles at another woman with long blonde hair.
The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek.
The camera angle is a close-up, focused on the woman with brown hair's face. The lighting is warm and 
natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage
"""
negative_prompt = "worst quality, inconsistent motion, blurry, jittery, distorted"

video = pipeline(
    prompt=prompt,
    negative_prompt=negative_prompt,
    width=768,
    height=512,
    num_frames=161,
    decode_timestep=0.03,
    decode_noise_scale=0.025,
    num_inference_steps=50,
).frames[0]
export_to_video(video, "output.mp4", fps=24)
```

[Compilation](../../optimization/fp16#torchcompile) sẽ chậm ở lần đầu tiên nhưng các lần gọi pipeline sau đó sẽ nhanh hơn. [Caching](../../optimization/cache) cũng có thể tăng tốc suy luận bằng cách lưu trữ và tái sử dụng các đầu ra trung gian.

```py
import torch
from diffusers import LTXPipeline
from diffusers.utils import export_to_video

pipeline = LTXPipeline.from_pretrained(
    "Lightricks/LTX-Video", dtype=torch.bfloat16
)

# torch.compile
pipeline.transformer.to(memory_format=torch.channels_last)
pipeline.transformer = torch.compile(
    pipeline.transformer, mode="max-autotune", fullgraph=True
)

prompt = """
A woman with long brown hair and light skin smiles at another woman with long blonde hair.
The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek.
The camera angle is a close-up, focused on the woman with brown hair's face. The lighting is warm and 
natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage
"""
negative_prompt = "worst quality, inconsistent motion, blurry, jittery, distorted"

video = pipeline(
    prompt=prompt,
    negative_prompt=negative_prompt,
    width=768,
    height=512,
    num_frames=161,
    decode_timestep=0.03,
    decode_noise_scale=0.025,
    num_inference_steps=50,
).frames[0]
export_to_video(video, "output.mp4", fps=24)
```

## Ghi chú

- Tham khảo các cài đặt được khuyến nghị sau để tạo nội dung từ kho [LTX-Video](https://github.com/Lightricks/LTX-Video).

  - dtype được khuyến nghị cho transformer, VAE và text encoder là `torch.bfloat16`. VAE và text encoder cũng có thể là `torch.float32` hoặc `torch.float16`.
  - Đối với các biến thể LTX-Video được chưng cất bằng guidance, hãy đặt `guidance_scale` thành `1.0`. `guidance_scale` của bất kỳ model nào khác nên được đặt cao hơn, chẳng hạn `5.0`, để đạt chất lượng sinh thành tốt.
  - Đối với các biến thể VAE nhận biết bước thời gian (LTX-Video 0.9.1 trở lên), đặt `decode_timestep` thành `0.05` và `image_cond_noise_scale` thành `0.025`.
  - Đối với các biến thể hỗ trợ nội suy giữa nhiều hình ảnh và video điều kiện (LTX-Video 0.9.5 trở lên), hãy sử dụng các hình ảnh và video tương tự để đạt kết quả tốt nhất. Sự khác biệt so với các đầu vào điều kiện có thể dẫn đến các chuyển cảnh đột ngột trong video được tạo ra.

- LTX-Video 0.9.7 bao gồm một bộ tăng độ phân giải không gian cho latent và một transformer có 13B tham số. Trong quá trình suy luận, một video độ phân giải thấp sẽ được tạo nhanh trước, sau đó được tăng độ phân giải và tinh chỉnh.

  
  Hiển thị mã ví dụ

  ```py
  import torch
  from diffusers import LTXConditionPipeline, LTXLatentUpsamplePipeline
  from diffusers.pipelines.ltx.pipeline_ltx_condition import LTXVideoCondition
  from diffusers.utils import export_to_video, load_video

  pipeline = LTXConditionPipeline.from_pretrained("Lightricks/LTX-Video-0.9.7-dev", dtype=torch.bfloat16)
  pipeline_upsample = LTXLatentUpsamplePipeline.from_pretrained("Lightricks/ltxv-spatial-upscaler-0.9.7", vae=pipeline.vae, dtype=torch.bfloat16)
  pipeline.to("cuda")  # or "mps", "xpu", "cpu"
  pipe_upsample.to("cuda")
  pipeline.vae.enable_tiling()

  def round_to_nearest_resolution_acceptable_by_vae(height, width):
      height = height - (height % pipeline.vae_temporal_compression_ratio)
      width = width - (width % pipeline.vae_temporal_compression_ratio)
      return height, width

  video = load_video(
      "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cosmos/cosmos-video2world-input-vid.mp4"
  )[:21]  # only use the first 21 frames as conditioning
  condition1 = LTXVideoCondition(video=video, frame_index=0)

  prompt = """
  The video depicts 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"
  expected_height, expected_width = 768, 1152
  downscale_factor = 2 / 3
  num_frames = 161

  # 1. Generate video at smaller resolution
  # Text-only conditioning is also supported without the need to pass `conditions`
  downscaled_height, downscaled_width = int(expected_height * downscale_factor), int(expected_width * downscale_factor)
  downscaled_height, downscaled_width = round_to_nearest_resolution_acceptable_by_vae(downscaled_height, downscaled_width)
  latents = pipeline(
      conditions=[condition1],
      prompt=prompt,
      negative_prompt=negative_prompt,
      width=downscaled_width,
      height=downscaled_height,
      num_frames=num_frames,
      num_inference_steps=30,
      decode_timestep=0.05,
      decode_noise_scale=0.025,
      image_cond_noise_scale=0.0,
      guidance_scale=5.0,
      guidance_rescale=0.7,
      generator=torch.Generator().manual_seed(0),
      output_type="latent",
  ).frames

  # 2. Upscale generated video using latent upsampler with fewer inference steps
  # The available latent upsampler upscales the height/width by 2x
  upscaled_height, upscaled_width = downscaled_height * 2, downscaled_width * 2
  upscaled_latents = pipe_upsample(
      latents=latents,
      output_type="latent"
  ).frames

  # 3. Denoise the upscaled video with few steps to improve texture (optional, but recommended)
  video = pipeline(
      conditions=[condition1],
      prompt=prompt,
      negative_prompt=negative_prompt,
      width=upscaled_width,
      height=upscaled_height,
      num_frames=num_frames,
      denoise_strength=0.4,  # Effectively, 4 inference steps out of 10
      num_inference_steps=10,
      latents=upscaled_latents,
      decode_timestep=0.05,
      decode_noise_scale=0.025,
      image_cond_noise_scale=0.0,
      guidance_scale=5.0,
      guidance_rescale=0.7,
      generator=torch.Generator().manual_seed(0),
      output_type="pil",
  ).frames[0]

  # 4. Downscale the video to the expected resolution
  video = [frame.resize((expected_width, expected_height)) for frame in video]

  export_to_video(video, "output.mp4", fps=24)
  ```

  

- Mô hình distilled LTX-Video 0.9.7 được distilled về guidance và timestep để tăng tốc độ tạo nội dung. Nó yêu cầu `guidance_scale` phải được đặt thành `1.0` và `num_inference_steps` nên được đặt trong khoảng từ `4` đến `10` để đạt chất lượng tạo tốt. Bạn cũng nên sử dụng các timestep tùy chỉnh sau để có kết quả tốt nhất.

  - Suy luận mô hình cơ bản để chuẩn bị cho việc tăng độ phân giải: `[1000, 993, 987, 981, 975, 909, 725, 0.03]`.
  - Upscaling: `[1000, 909, 725, 421, 0]`.

  
  Hiển thị mã ví dụ

  ```py
  import torch
  from diffusers import LTXConditionPipeline, LTXLatentUpsamplePipeline
  from diffusers.pipelines.ltx.pipeline_ltx_condition import LTXVideoCondition
  from diffusers.utils import export_to_video, load_video

  pipeline = LTXConditionPipeline.from_pretrained("Lightricks/LTX-Video-0.9.7-distilled", dtype=torch.bfloat16)
  pipe_upsample = LTXLatentUpsamplePipeline.from_pretrained("Lightricks/ltxv-spatial-upscaler-0.9.7", vae=pipeline.vae, dtype=torch.bfloat16)
  pipeline.to("cuda")  # or "mps", "xpu", "cpu"
  pipe_upsample.to("cuda")
  pipeline.vae.enable_tiling()

  def round_to_nearest_resolution_acceptable_by_vae(height, width):
      height = height - (height % pipeline.vae_spatial_compression_ratio)
      width = width - (width % pipeline.vae_spatial_compression_ratio)
      return height, width

  prompt = """
  artistic anatomical 3d render, utlra quality, human half full male body with transparent 
  skin revealing structure instead of organs, muscular, intricate creative patterns, 
  monochromatic with backlighting, lightning mesh, scientific concept art, blending biology 
  with botany, surreal and ethereal quality, unreal engine 5, ray tracing, ultra realistic, 
  16K UHD, rich details. camera zooms out in a rotating fashion
  """
  negative_prompt = "worst quality, inconsistent motion, blurry, jittery, distorted"
  expected_height, expected_width = 768, 1152
  downscale_factor = 2 / 3
  num_frames = 161

  # 1. Generate video at smaller resolution
  downscaled_height, downscaled_width = int(expected_height * downscale_factor), int(expected_width * downscale_factor)
  downscaled_height, downscaled_width = round_to_nearest_resolution_acceptable_by_vae(downscaled_height, downscaled_width)
  latents = pipeline(
      prompt=prompt,
      negative_prompt=negative_prompt,
      width=downscaled_width,
      height=downscaled_height,
      num_frames=num_frames,
      timesteps=[1000, 993, 987, 981, 975, 909, 725, 0.03],
      decode_timestep=0.05,
      decode_noise_scale=0.025,
      image_cond_noise_scale=0.0,
      guidance_scale=1.0,
      guidance_rescale=0.7,
      generator=torch.Generator().manual_seed(0),
      output_type="latent",
  ).frames

  # 2. Upscale generated video using latent upsampler with fewer inference steps
  # The available latent upsampler upscales the height/width by 2x
  upscaled_height, upscaled_width = downscaled_height * 2, downscaled_width * 2
  upscaled_latents = pipe_upsample(
      latents=latents,
      adain_factor=1.0,
      output_type="latent"
  ).frames

  # 3. Denoise the upscaled video with few steps to improve texture (optional, but recommended)
  video = pipeline(
      prompt=prompt,
      negative_prompt=negative_prompt,
      width=upscaled_width,
      height=upscaled_height,
      num_frames=num_frames,
      denoise_strength=0.999,  # Effectively, 4 inference steps out of 5
      timesteps=[1000, 909, 725, 421, 0],
      latents=upscaled_latents,
      decode_timestep=0.05,
      decode_noise_scale=0.025,
      image_cond_noise_scale=0.0,
      guidance_scale=1.0,
      guidance_rescale=0.7,
      generator=torch.Generator().manual_seed(0),
      output_type="pil",
  ).frames[0]

  # 4. Downscale the video to the expected resolution
  video = [frame.resize((expected_width, expected_height)) for frame in video]

  export_to_video(video, "output.mp4", fps=24)
  ```

  

- Mô hình LTX-Video 0.9.8 distilled tương tự biến thể 0.9.7. Nó được distilled về guidance và timestep, và có thể sử dụng mã suy luận tương tự như ở trên. Một cải tiến của phiên bản này là hỗ trợ tạo các video rất dài. Ngoài ra, nó hỗ trợ sử dụng tone mapping để cải thiện chất lượng video được tạo ra bằng tham số `tone_map_compression_ratio`. Giá trị mặc định `0.6` được khuyến nghị.

  
  Hiển thị mã ví dụ

  ```python
  import torch
  from diffusers import LTXConditionPipeline, LTXLatentUpsamplePipeline
  from diffusers.pipelines.ltx.pipeline_ltx_condition import LTXVideoCondition
  from diffusers.models.latent_upscaler import LTXLatentUpsamplerModel
  from diffusers.utils import export_to_video, load_video

  pipeline = LTXConditionPipeline.from_pretrained("Lightricks/LTX-Video-0.9.8-13B-distilled", dtype=torch.bfloat16)
  # TODO: Update the checkpoint here once updated in LTX org
  upsampler = LTXLatentUpsamplerModel.from_pretrained("a-r-r-o-w/LTX-0.9.8-Latent-Upsampler", dtype=torch.bfloat16)
  pipe_upsample = LTXLatentUpsamplePipeline(vae=pipeline.vae, latent_upsampler=upsampler).to(torch.bfloat16)
  pipeline.to("cuda")  # or "mps", "xpu", "cpu"
  pipe_upsample.to("cuda")
  pipeline.vae.enable_tiling()

  def round_to_nearest_resolution_acceptable_by_vae(height, width):
      height = height - (height % pipeline.vae_spatial_compression_ratio)
      width = width - (width % pipeline.vae_spatial_compression_ratio)
      return height, width

  prompt = """The camera pans over a snow-covered mountain range, revealing a vast expanse of snow-capped peaks and valleys.The mountains are covered in a thick layer of snow, with some areas appearing almost white while others have a slightly darker, almost grayish hue. The peaks are jagged and irregular, with some rising sharply into the sky while others are more rounded. The valleys are deep and narrow, with steep slopes that are also covered in snow. The trees in the foreground are mostly bare, with only a few leaves remaining on their branches. The sky is overcast, with thick clouds obscuring the sun. The overall impression is one of peace and tranquility, with the snow-covered mountains standing as a testament to the power and beauty of nature."""
  # prompt = """A woman walks away from a white Jeep parked on a city street at night, then ascends a staircase and knocks on a door. The woman, wearing a dark jacket and jeans, walks away from the Jeep parked on the left side of the street, her back to the camera; she walks at a steady pace, her arms swinging slightly by her sides; the street is dimly lit, with streetlights casting pools of light on the wet pavement; a man in a dark jacket and jeans walks past the Jeep in the opposite direction; the camera follows the woman from behind as she walks up a set of stairs towards a building with a green door; she reaches the top of the stairs and turns left, continuing to walk towards the building; she reaches the door and knocks on it with her right hand; the camera remains stationary, focused on the doorway; the scene is captured in real-life footage."""
  negative_prompt = "bright colors, symbols, graffiti, watermarks, worst quality, inconsistent motion, blurry, jittery, distorted"
  expected_height, expected_width = 480, 832
  downscale_factor = 2 / 3
  # num_frames = 161
  num_frames = 361

  # 1. Generate video at smaller resolution
  downscaled_height, downscaled_width = int(expected_height * downscale_factor), int(expected_width * downscale_factor)
  downscaled_height, downscaled_width = round_to_nearest_resolution_acceptable_by_vae(downscaled_height, downscaled_width)
  latents = pipeline(
      prompt=prompt,
      negative_prompt=negative_prompt,
      width=downscaled_width,
      height=downscaled_height,
      num_frames=num_frames,
      timesteps=[1000, 993, 987, 981, 975, 909, 725, 0.03],
      decode_timestep=0.05,
      decode_noise_scale=0.025,
      image_cond_noise_scale=0.0,
      guidance_scale=1.0,
      guidance_rescale=0.7,
      generator=torch.Generator().manual_seed(0),
      output_type="latent",
  ).frames

  # 2. Upscale generated video using latent upsampler with fewer inference steps
  # The available latent upsampler upscales the height/width by 2x
  upscaled_height, upscaled_width = downscaled_height * 2, downscaled_width * 2
  upscaled_latents = pipe_upsample(
      latents=latents,
      adain_factor=1.0,
      tone_map_compression_ratio=0.6,
      output_type="latent"
  ).frames

  # 3. Denoise the upscaled video with few steps to improve texture (optional, but recommended)
  video = pipeline(
      prompt=prompt,
      negative_prompt=negative_prompt,
      width=upscaled_width,
      height=upscaled_height,
      num_frames=num_frames,
      denoise_strength=0.999,  # Effectively, 4 inference steps out of 5
      timesteps=[1000, 909, 725, 421, 0],
      latents=upscaled_latents,
      decode_timestep=0.05,
      decode_noise_scale=0.025,
      image_cond_noise_scale=0.0,
      guidance_scale=1.0,
      guidance_rescale=0.7,
      generator=torch.Generator().manual_seed(0),
      output_type="pil",
  ).frames[0]

  # 4. Downscale the video to the expected resolution
  video = [frame.resize((expected_width, expected_height)) for frame in video]

  export_to_video(video, "output.mp4", fps=24)
  ```

  

- LTX-Video hỗ trợ LoRA với [load_lora_weights()](/docs/diffusers/main/vi/api/loaders/lora#diffusers.loaders.LTXVideoLoraLoaderMixin.load_lora_weights).

  
  Hiển thị mã ví dụ

  ```py
  import torch
  from diffusers import LTXConditionPipeline
  from diffusers.utils import export_to_video, load_image

  pipeline = LTXConditionPipeline.from_pretrained(
      "Lightricks/LTX-Video-0.9.5", dtype=torch.bfloat16
  )

  pipeline.load_lora_weights("Lightricks/LTX-Video-Cakeify-LoRA", adapter_name="cakeify")
  pipeline.set_adapters("cakeify")

  # use "CAKEIFY" to trigger the LoRA
  prompt = "CAKEIFY a person using a knife to cut a cake shaped like a Pikachu plushie"
  image = load_image("https://huggingface.co/Lightricks/LTX-Video-Cakeify-LoRA/resolve/main/assets/images/pikachu.png")

  video = pipeline(
      prompt=prompt,
      image=image,
      width=576,
      height=576,
      num_frames=161,
      decode_timestep=0.03,
      decode_noise_scale=0.025,
      num_inference_steps=50,
  ).frames[0]
  export_to_video(video, "output.mp4", fps=26)
  ```

  

- LTX-Video hỗ trợ nạp từ các tệp đơn lẻ, chẳng hạn như [GGUF checkpoints](../../quantization/gguf), bằng [loaders.FromOriginalModelMixin.from_single_file()](/docs/diffusers/main/vi/api/loaders/single_file#diffusers.loaders.FromOriginalModelMixin.from_single_file) hoặc [loaders.FromSingleFileMixin.from_single_file()](/docs/diffusers/main/vi/api/loaders/single_file#diffusers.loaders.FromSingleFileMixin.from_single_file).

  
  Hiển thị mã ví dụ

  ```py
  import torch
  from diffusers.utils import export_to_video
  from diffusers import LTXPipeline, AutoModel, GGUFQuantizationConfig

  transformer = AutoModel.from_single_file(
      "https://huggingface.co/city96/LTX-Video-gguf/blob/main/ltx-video-2b-v0.9-Q3_K_S.gguf"
      quantization_config=GGUFQuantizationConfig(compute_dtype=torch.bfloat16),
      dtype=torch.bfloat16
  )
  pipeline = LTXPipeline.from_pretrained(
      "Lightricks/LTX-Video",
      transformer=transformer,
      dtype=torch.bfloat16
  )
  ```

  

## LTXI2VLongMultiPromptPipeline[[diffusers.LTXI2VLongMultiPromptPipeline]]

#### diffusers.LTXI2VLongMultiPromptPipeline[[diffusers.LTXI2VLongMultiPromptPipeline]]

```python
diffusers.LTXI2VLongMultiPromptPipeline(scheduler: FlowMatchEulerDiscreteScheduler, vae: AutoencoderKLLTXVideo, text_encoder: T5EncoderModel, tokenizer: T5TokenizerFast, transformer: LTXVideoTransformer3DModel)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx_i2v_long_multi_prompt.py#L389)

**Tham số:**

transformer ([LTXVideoTransformer3DModel](/docs/diffusers/main/vi/api/models/ltx_video_transformer3d#diffusers.LTXVideoTransformer3DModel)) : Kiến trúc Transformer có điều kiện để khử nhiễu các latents video đã mã hóa.

scheduler ([FlowMatchEulerDiscreteScheduler](/docs/diffusers/main/vi/api/schedulers/flow_match_euler_discrete#diffusers.FlowMatchEulerDiscreteScheduler) hoặc `LTXEulerAncestralRFScheduler`) : Một scheduler được sử dụng kết hợp với `transformer` để khử nhiễu các latents của ảnh đã được mã hóa.

vae ([AutoencoderKLLTXVideo](/docs/diffusers/main/vi/api/models/autoencoderkl_ltx_video#diffusers.AutoencoderKLLTXVideo)) : Mô hình Variational Auto-Encoder (VAE) để mã hóa và giải mã hình ảnh từ và sang các biểu diễn ẩn.

text_encoder (`T5EncoderModel`) : [T5](https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5EncoderModel), cụ thể là biến thể [google/t5-v1_1-xxl](https://huggingface.co/google/t5-v1_1-xxl).

tokenizer (`T5TokenizerFast`) : Tokenizer của lớp [T5TokenizerFast](https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5TokenizerFast).

Pipeline đa prompt I2V (image-to-video) thời lượng dài với độ tương thích ComfyUI.

Các tính năng chính:
- Chỉ lấy mẫu cửa sổ trượt theo thời gian (không chia sẻ không gian H/W); kết hợp tự hồi quy giữa các cửa sổ.
- Phân đoạn đa prompt cho mỗi cửa sổ với các chuyển tiếp mượt mà tại đầu cửa sổ.
- Điều kiện cứng khung hình đầu tiên thông qua mặt nạ theo từng token cho I2V.
- Kiểm soát VRAM thông qua phân tách theo thời gian và giải mã VAE theo từng ô.

Tham khảo: https://github.com/Lightricks/LTX-Video

#### __call__[[diffusers.LTXI2VLongMultiPromptPipeline.__call__]]

```python
__call__(prompt: str | list[str] = None, negative_prompt: str | list[str] | None = None, prompt_segments: list[dict[str, Any]] | None = None, height: int = 512, width: int = 704, num_frames: int = 161, frame_rate: float = 25, guidance_scale: float = 1.0, guidance_rescale: float = 0.0, num_inference_steps: int | None = 8, sigmas: list[float, torch.Tensor] | None = None, generator: torch.Generator | list[torch.Generator] | None = None, seed: int | None = 0, cond_image: 'PIL.Image.Image' | torch.Tensor | None = None, cond_strength: float = 0.5, latents: torch.Tensor | None = None, temporal_tile_size: int = 80, temporal_overlap: int = 24, temporal_overlap_cond_strength: float = 0.5, adain_factor: float = 0.25, guidance_latents: torch.Tensor | None = None, guiding_strength: float = 1.0, negative_index_latents: torch.Tensor | None = None, negative_index_strength: float = 1.0, skip_steps_sigma_threshold: float | None = 1, decode_timestep: float | None = 0.05, decode_noise_scale: float | None = 0.025, decode_horizontal_tiles: int = 4, decode_vertical_tiles: int = 4, decode_overlap: int = 3, output_type: str | None = 'latent', return_dict: bool = True, attention_kwargs: dict[str, Any] | None = None, callback_on_step_end: Callable[[int, int], None] | None = None, callback_on_step_end_tensor_inputs: list[str] = ['latents'], max_sequence_length: int = 128)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx_i2v_long_multi_prompt.py#L935)

**Tham số:**

prompt (`str` hoặc `list[str]`, *tùy chọn*) : Prompt văn bản tích cực cho mỗi cửa sổ. Nếu một chuỗi duy nhất chứa '|', các phần sẽ được tách theo các thanh.

negative_prompt (`str` hoặc `list[str]`, *tùy chọn*) : Prompt âm để loại bỏ nội dung không mong muốn.

prompt_segments (`list[dict]`, *tùy chọn*) : Ánh xạ phân đoạn với {"start_window", "end_window", "text"} để ghi đè các prompt theo từng cửa sổ.

height (`int`, mặc định là `512`) : Chiều cao của ảnh đầu ra tính bằng pixel; phải chia hết cho 32.

width (`int`, mặc định là `704`) : Độ rộng của ảnh đầu ra tính bằng pixel; phải chia hết cho 32.

num_frames (`int`, mặc định là `161`) : Số lượng khung hình đầu ra (trong không gian pixel đã giải mã).

frame_rate (`float`, mặc định là `25`) : Số khung hình mỗi giây; được dùng để chuẩn hóa các tọa độ thời gian trong `video_coords`.

guidance_scale (`float`, mặc định là `1.0`) : thang CFG; các giá trị > 1 kích hoạt hướng dẫn không có bộ phân loại.

guidance_rescale (`float`, mặc định là `0.0`) : Tham số tùy chọn để điều chỉnh lại thang đo nhằm giảm thiểu hiện tượng quá phơi sáng dưới CFG (xem `rescale_noise_cfg`).

num_inference_steps (`int`, *optional*, mặc định là `8`) : Số bước khử nhiễu cho mỗi cửa sổ. Bỏ qua nếu `sigmas` được cung cấp.

sigmas (`list[float]` hoặc `torch.Tensor`, *tùy chọn*) : Lịch sigma rõ ràng cho từng cửa sổ; nếu được đặt, sẽ ghi đè lên `num_inference_steps`.

generator (`torch.Generator` hoặc `list[torch.Generator]`, *tùy chọn*) : Kiểm soát tính ngẫu nhiên; chấp nhận danh sách nhưng chỉ sử dụng phần tử đầu tiên (batch=1).

seed (`int`, *optional*, mặc định là `0`) : Nếu được cung cấp, sẽ khởi tạo bộ tạo số ngẫu nhiên dùng chung cho các biến tiềm năng toàn cục và suy ra bộ tạo số ngẫu nhiên cục bộ theo cửa sổ với `seed + w_start` cho từng cửa sổ thời gian.

cond_image (`PIL.Image.Image` hoặc `torch.Tensor`, *tuỳ chọn*) : Ảnh điều kiện; cố định khung 0 thông qua mặt nạ theo từng token khi `cond_strength > 0`.

cond_strength (`float`, mặc định là `0.5`) : Độ mạnh của điều kiện cứng cho khung hình đầu tiên (cond_mask nhỏ hơn ⇒ bảo toàn mạnh hơn).

latents (`torch.Tensor`, *tùy chọn*) : Latents ban đầu [B, C_lat, F_lat, H_lat, W_lat]; nếu là None, sẽ được lấy mẫu bằng `randn_tensor`.

temporal_tile_size (`int`, mặc định là `80`) : Kích thước cửa sổ thời gian (tính bằng số khung hình đã giải mã); được nhân bên trong bởi hệ số nén thời gian của VAE.

temporal_overlap (`int`, mặc định là `24`) : Phần chồng lấn giữa các cửa sổ liên tiếp (tính theo số khung đã giải mã); được nhân nội bộ theo hệ số nén.

temporal_overlap_cond_strength (`float`, mặc định là `0.5`) : Cường độ để tiêm các latents cuối của cửa sổ trước vào đầu của cửa sổ mới.

adain_factor (`float`, mặc định là `0.25`) : Độ mạnh của chuẩn hóa AdaIN cho tính nhất quán giữa các cửa sổ (0 để tắt).

guidance_latents (`torch.Tensor`, *tùy chọn*) : Tham chiếu latents được tiêm vào đầu cửa sổ; độ dài bị cắt bớt bởi phần chồng lấn cho các cửa sổ tiếp theo.

guiding_strength (`float`, mặc định là `1.0`) : Cường độ tiêm cho `guidance_latents`.

negative_index_latents (`torch.Tensor`, *tùy chọn*) : Một latent đơn khung được thêm vào đầu cửa sổ cho ngữ nghĩa "chỉ số âm".

negative_index_strength (`float`, mặc định là `1.0`) : Cường độ tiêm cho `negative_index_latents`.

skip_steps_sigma_threshold (`float`, *tuỳ chọn*, mặc định là `1`) : Bỏ qua các bước có sigma vượt quá ngưỡng này.

decode_timestep (`float`, *tùy chọn*, mặc định là `0.05`) : Timestep khi giải mã (nếu VAE hỗ trợ timestep_conditioning).

decode_noise_scale (`float`, *tuỳ chọn*, mặc định là `0.025`) : Thang độ trộn nhiễu khi giải mã (nếu VAE hỗ trợ timestep_conditioning).

decode_horizontal_tiles (`int`, mặc định là `4`) : Số lượng ô gạch ngang trong quá trình giải mã VAE.

decode_vertical_tiles (`int`, mặc định là `4`) : Số lượng gạch dọc trong quá trình giải mã VAE.

decode_overlap (`int`, mặc định là `3`) : Phần chồng lấn (tính bằng pixel tiềm ẩn) giữa các ô (tiles) trong quá trình giải mã VAE.

output_type (`str`, *tùy chọn*, mặc định là `"latent"`) : Định dạng đầu ra của video được tạo. Chọn giữa "latent", "pt", "np" hoặc "pil". Nếu là "latent", sẽ trả về latents mà không giải mã.

return_dict (`bool`, *tùy chọn*, mặc định là `True`) : Có nên trả về một `~pipelines.ltx.LTXPipelineOutput` thay vì một tuple thông thường hay không.

attention_kwargs (`dict`, *tùy chọn*) : Các tham số chú ý bổ sung được chuyển tiếp đến transformer.

callback_on_step_end (`PipelineCallback` hoặc `MultiPipelineCallbacks`, *tùy chọn*) : Hook callback cho từng bước.

callback_on_step_end_tensor_inputs (`list[str]`, mặc định là `["latents"]`) : Các khóa từ locals() để truyền vào callback.

max_sequence_length (`int`, mặc định là `128`) : Độ dài tối đa của Tokenizer cho việc mã hóa prompt.

**Trả về:** `~pipelines.ltx.LTXPipelineOutput` hoặc `tuple`

Nếu `return_dict` là `True`, `~pipelines.ltx.LTXPipelineOutput` sẽ được trả về, ngược lại một `tuple` sẽ được trả về trong đó phần tử đầu tiên là một danh sách chứa các khung hình đã tạo. Định dạng đầu ra phụ thuộc vào `output_type`:
- "latent"/"pt": `torch.Tensor` [B, C, F, H, W]; "latent" nằm trong không gian latent đã chuẩn hóa, "pt" nằm trong không gian đầu ra của VAE.
- "np": `np.ndarray` đã xử lý hậu kỳ.
- "pil": `list[PIL.Image.Image]` danh sách các hình ảnh PIL.

Tạo chuỗi hình ảnh-đoạn video thông qua các cửa sổ trượt theo thời gian và lịch trình đa prompt.

Ví dụ:
```py
>>> import torch
>>> from diffusers import LTXEulerAncestralRFScheduler, LTXI2VLongMultiPromptPipeline

>>> pipe = LTXI2VLongMultiPromptPipeline.from_pretrained("LTX-Video-0.9.8-13B-distilled")
>>> # For ComfyUI parity, swap in the RF scheduler (keeps the original config).
>>> pipe.scheduler = LTXEulerAncestralRFScheduler.from_config(pipe.scheduler.config)
>>> pipe = pipe.to("cuda").to(dtype=torch.bfloat16)
>>> # Example A: get decoded frames (PIL)
>>> out = pipe(
...     prompt="a chimpanzee walks | a chimpanzee eats",
...     num_frames=161,
...     height=512,
...     width=704,
...     temporal_tile_size=80,
...     temporal_overlap=24,
...     output_type="pil",
...     return_dict=True,
... )
>>> frames = out.frames[0]  # list of PIL.Image.Image
>>> # Example B: get latent video and decode later (saves VRAM during sampling)
>>> out_latent = pipe(prompt="a chimpanzee walking", output_type="latent", return_dict=True).frames
>>> frames = pipe.vae_decode_tiled(out_latent, output_type="pil")[0]
```

Shapes: Kích thước tiềm ẩn (khi tự động tạo):
- F_lat = (num_frames - 1) // vae_temporal_compression_ratio + 1
- H_lat = height // vae_spatial_compression_ratio
- W_lat = width // vae_spatial_compression_ratio

Ghi chú:
- Seeding: khi `seed` được cung cấp, mỗi cửa sổ thời gian sử dụng một trình tạo cục bộ được khởi tạo bằng `seed + w_start`, trong khi trình tạo dùng chung được khởi tạo một lần cho các latent toàn cục nếu không có trình tạo nào được truyền vào; ngược lại, trình tạo được truyền vào sẽ được tái sử dụng.
- CFG: `noise_pred = uncond + w * (text - uncond)` thống nhất với `guidance_rescale` tùy chọn.
- Bộ nhớ: denoising thực hiện dự đoán toàn khung hình (không chia ô không gian); quá trình giải mã có thể được chia ô để tránh OOM.

#### encode_prompt[[diffusers.LTXI2VLongMultiPromptPipeline.encode_prompt]]

```python
encode_prompt(prompt: str | list[str], negative_prompt: str | list[str] | None = None, do_classifier_free_guidance: bool = True, num_videos_per_prompt: int = 1, prompt_embeds: torch.Tensor | None = None, negative_prompt_embeds: torch.Tensor | None = None, prompt_attention_mask: torch.Tensor | None = None, negative_prompt_attention_mask: torch.Tensor | None = None, max_sequence_length: int = 128, device: torch.device | None = None, dtype: torch.dtype | None = None)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx_i2v_long_multi_prompt.py#L552)

**Tham số:**

prompt (`str` hoặc `list[str]`, *tùy chọn*) : prompt cần được mã hóa

negative_prompt (`str` hoặc `list[str]`, *tùy chọn*) : Prompt hoặc các prompt không được dùng để hướng dẫn việc tạo ảnh. Nếu không được định nghĩa, bạn phải truyền `negative_prompt_embeds` thay thế. Bỏ qua khi không sử dụng guidance (tức là bị bỏ qua nếu `guidance_scale` nhỏ hơn `1`).

do_classifier_free_guidance (`bool`, *tùy chọn*, mặc định là `True`) : Có sử dụng classifier free guidance hay không.

num_videos_per_prompt (`int`, *optional*, mặc định là 1) : Số lượng video cần được tạo cho mỗi prompt. Thiết bị torch để đặt các embeddings kết quả lên

prompt_embeds (`torch.Tensor`, *tùy chọn*) : Các vector nhúng văn bản đã được tạo trước. Có thể được sử dụng để dễ dàng điều chỉnh các đầu vào văn bản, *vd.* trọng số prompt. Nếu không được cung cấp, các vector nhúng văn bản sẽ được tạo từ đối số đầu vào `prompt`.

negative_prompt_embeds (`torch.Tensor`, *tùy chọn*) : Các vector nhúng văn bản âm đã được tạo trước. Có thể được sử dụng để dễ dàng điều chỉnh các đầu vào văn bản, *vd.* trọng số prompt. Nếu không được cung cấp, negative_prompt_embeds sẽ được tạo từ đối số đầu vào `negative_prompt`.

device : (`torch.device`, *tùy chọn*): thiết bị torch

dtype : (`torch.dtype`, *tùy chọn*): torch dtype

Mã hóa prompt thành các trạng thái ẩn của text encoder.

#### prepare_latents[[diffusers.LTXI2VLongMultiPromptPipeline.prepare_latents]]

```python
prepare_latents(batch_size: int, num_channels_latents: int, height: int, width: int, num_frames: int, device: torch.device, generator: torch.Generator | None, dtype: torch.dtype = torch.float32, latents: torch.Tensor | None = None, cond_latents: torch.Tensor | None = None, cond_strength: float = 0.0, negative_index_latents: torch.Tensor | None = None)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx_i2v_long_multi_prompt.py#L694)

**Trả về:**

latents, negative_index_latents, latent_num_frames, latent_height, latent_width

Chuẩn bị các latents cơ bản và tùy chọn tiêm các latents điều kiện khung hình đầu tiên.

#### vae_decode_tiled[[diffusers.LTXI2VLongMultiPromptPipeline.vae_decode_tiled]]

```python
vae_decode_tiled(latents: torch.Tensor, decode_timestep: float | None = None, decode_noise_scale: float | None = None, horizontal_tiles: int = 4, vertical_tiles: int = 4, overlap: int = 3, last_frame_fix: bool = True, generator: torch.Generator | None = None, output_type: str = 'pt', auto_denormalize: bool = True, compute_dtype: torch.dtype = torch.float32, enable_vae_tiling: bool = False)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx_i2v_long_multi_prompt.py#L738)

**Tham số:**

latents : [B, C_latent, F_latent, H_latent, W_latent]

decode_timestep : Bước thời gian giải mã tùy chọn (chỉ có hiệu lực nếu VAE hỗ trợ timestep_conditioning)

decode_noise_scale : Nội suy nhiễu giải mã tùy chọn (chỉ có hiệu lực nếu VAE hỗ trợ timestep_conditioning)

horizontal_tiles, vertical_tiles : Số lượng ô lát theo chiều ngang/dọc (>= 1)

overlap : Sự chồng chéo trong không gian ẩn (theo pixel ẩn, >= 0)

last_frame_fix : Có bật sửa lỗi "lặp lại khung hình cuối" hay không

generator : Bộ tạo ngẫu nhiên (được dùng cho nhiễu decode_noise_scale)

output_type : "latent" | "pt" | "np" | "pil" - "latent": trả về latents không thay đổi (hữu ích cho xử lý tiếp theo) - "pt": trả về tensor trong không gian đầu ra của VAE - "np"/"pil": đầu ra đã xử lý hậu kỳ qua VideoProcessor.postprocess_video

auto_denormalize : Nếu là True, áp dụng khử chuẩn hóa LTX cho `latents` bên trong (khuyến nghị)

compute_dtype : Độ chính xác được sử dụng trong quá trình hợp nhất tile (mặc định là float32; giảm đáng kể hiện tượng mờ ở các đường nối)

enable_vae_tiling : Nếu là True, ủy quyền việc chia ô cho `tiled_decode` tích hợp sẵn của VAE (đặt `vae.use_tiling`).

**Returns:** `- If output_type="latent"`

trả về `latents` đầu vào không thay đổi
- Nếu output_type="pt": trả về [B, C, F, H, W] (giá trị xấp xỉ trong [-1, 1])
- Nếu output_type="np"/"pil": trả về các đầu ra đã xử lý hậu kỳ thông qua postprocess_video

Giải mã không gian dạng gạch (spatial tiled) dựa trên VAE (tương đương ComfyUI) được triển khai theo phong cách Diffusers.
- Làm mờ tuyến tính và trộn các ô chồng lấn để tránh các đường nối.
- Tuỳ chọn last_frame_fix: nhân bản khung latent cuối cùng trước khi giải mã, sau đó loại bỏ time_scale_factor khung ở cuối.
- Hỗ trợ tiêm (injection) timestep_conditioning và decode_noise_scale.
- Mặc định, "normalized latents" (kết quả khử nhiễu) sẽ được khử chuẩn hóa bên trong (auto_denormalize=True).
- Tile fusion được tính toán trong compute_dtype (mặc định là float32) để giảm mờ và sai lệch màu.

## LTXPipeline[[diffusers.LTXPipeline]]

#### diffusers.LTXPipeline[[diffusers.LTXPipeline]]

```python
diffusers.LTXPipeline(scheduler: FlowMatchEulerDiscreteScheduler, vae: AutoencoderKLLTXVideo, text_encoder: T5EncoderModel, tokenizer: T5Tokenizer, transformer: LTXVideoTransformer3DModel)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx.py#L170)

**Tham số:**

transformer ([LTXVideoTransformer3DModel](/docs/diffusers/main/vi/api/models/ltx_video_transformer3d#diffusers.LTXVideoTransformer3DModel)) : Kiến trúc Transformer có điều kiện để khử nhiễu các latents video đã mã hóa.

scheduler ([FlowMatchEulerDiscreteScheduler](/docs/diffusers/main/vi/api/schedulers/flow_match_euler_discrete#diffusers.FlowMatchEulerDiscreteScheduler)) : Một trình lập lịch được sử dụng kết hợp với `transformer` để khử nhiễu các latent ảnh đã mã hóa.

vae ([AutoencoderKLLTXVideo](/docs/diffusers/main/vi/api/models/autoencoderkl_ltx_video#diffusers.AutoencoderKLLTXVideo)) : Mô hình Variational Auto-Encoder (VAE) để mã hóa và giải mã hình ảnh từ và sang các biểu diễn ẩn.

text_encoder (`T5EncoderModel`) : [T5](https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5EncoderModel), cụ thể là biến thể [google/t5-v1_1-xxl](https://huggingface.co/google/t5-v1_1-xxl).

tokenizer (`CLIPTokenizer`) : Tokenizer của lớp [CLIPTokenizer](https://huggingface.co/docs/transformers/en/model_doc/clip#transformers.CLIPTokenizer).

tokenizer (`T5TokenizerFast`) : Tokenizer thứ hai của lớp [T5TokenizerFast](https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5TokenizerFast).

Pipeline để tạo video từ văn bản.

Tham khảo: https://github.com/Lightricks/LTX-Video

#### __call__[[diffusers.LTXPipeline.__call__]]

```python
__call__(prompt: str | list[str] = None, negative_prompt: str | list[str] | None = None, height: int = 512, width: int = 704, num_frames: int = 161, frame_rate: int = 25, num_inference_steps: int = 50, timesteps: list[int] = None, guidance_scale: float = 3, guidance_rescale: float = 0.0, num_videos_per_prompt: int | None = 1, generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = None, latents: typing.Optional[torch.Tensor] = None, prompt_embeds: typing.Optional[torch.Tensor] = None, prompt_attention_mask: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_attention_mask: typing.Optional[torch.Tensor] = None, decode_timestep: float | list[float] = 0.0, decode_noise_scale: float | list[float] | None = None, output_type: str | None = 'pil', return_dict: bool = True, attention_kwargs: dict[str, typing.Any] | None = None, callback_on_step_end: typing.Optional[typing.Callable[[int, int], NoneType]] = None, callback_on_step_end_tensor_inputs: list[str] = ['latents'], max_sequence_length: int = 128)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx.py#L535)

**Tham số:**

prompt (`str` hoặc `list[str]`, *tùy chọn*) : Prompt hoặc các prompt để hướng dẫn việc tạo ảnh. Nếu không được định nghĩa, bạn phải truyền `prompt_embeds` thay thế.

negative_prompt (`str` hoặc `list[str]`, *tùy chọn*) : Prompt hoặc các prompt không được dùng để định hướng việc tạo ảnh. Nếu không được định nghĩa, bạn phải truyền `negative_prompt_embeds` thay thế. Bỏ qua khi không sử dụng guidance (`guidance_scale < 1`).

height (`int`, mặc định là `512`) : Chiều cao của hình ảnh được tạo ra, tính bằng pixel. Giá trị này được đặt là 480 theo mặc định để đạt kết quả tốt nhất.

width (`int`, mặc định là `704`) : Độ rộng của hình ảnh được tạo ra, tính bằng pixel. Giá trị này được đặt là 848 theo mặc định để đạt kết quả tốt nhất.

num_frames (`int`, mặc định là `161`) : Số khung hình video cần tạo

frame_rate (`int`, mặc định là `25`) : Tốc độ khung hình mục tiêu của video được tạo ra.

num_inference_steps (`int`, *optional*, mặc định là 50) : Số bước khử nhiễu. Số bước khử nhiễu nhiều hơn thường dẫn đến hình ảnh có chất lượng cao hơn, với cái giá là suy luận chậm hơn.

timesteps (`list[int]`, *optional*) : Các bước thời gian (timesteps) tùy chỉnh để sử dụng cho quá trình khử nhiễu với các trình lập lịch (scheduler) hỗ trợ tham số `timesteps` trong phương thức `set_timesteps` của chúng. Nếu không được định nghĩa, hành vi mặc định khi `num_inference_steps` được truyền vào sẽ được sử dụng. Phải được sắp xếp theo thứ tự giảm dần.

guidance_scale (`float`, mặc định là `3 `) : Thang độ dẫn hướng như được định nghĩa trong [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598). `guidance_scale` được định nghĩa là `w` của phương trình 2. trong [Imagen Paper](https://huggingface.co/papers/2205.11487). Thang độ dẫn hướng được kích hoạt bằng cách đặt `guidance_scale > 1`. Thang độ dẫn hướng cao hơn khuyến khích tạo ra các hình ảnh gắn kết chặt chẽ với `prompt` văn bản, thường phải đánh đổi bằng chất lượng hình ảnh thấp hơn.

guidance_rescale (`float`, *tuỳ chọn*, mặc định là 0.0) : Hệ số rescale guidance được đề xuất bởi [Common Diffusion Noise Schedules and Sample Steps are Flawed](https://huggingface.co/papers/2305.08891) `guidance_scale` được định nghĩa là `φ` trong phương trình 16. của [Common Diffusion Noise Schedules and Sample Steps are Flawed](https://huggingface.co/papers/2305.08891). Hệ số rescale guidance nên khắc phục hiện tượng phơi sáng quá mức khi sử dụng zero terminal SNR.

num_videos_per_prompt (`int`, *tuỳ chọn*, mặc định là 1) : Số lượng video cần tạo cho mỗi prompt.

generator (`torch.Generator` hoặc `list[torch.Generator]`, *tùy chọn*) : Một hoặc một danh sách [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) để đảm bảo quá trình sinh là tất định.

latents (`torch.Tensor`, *tùy chọn*) : Các latents nhiễu đã được tạo trước, được lấy mẫu từ phân phối Gaussian, dùng làm đầu vào cho việc tạo ảnh. Có thể được sử dụng để tinh chỉnh cùng một quá trình tạo với các prompt khác nhau. Nếu không được cung cấp, một tensor latents sẽ được tạo ra bằng cách lấy mẫu sử dụng `generator` ngẫu nhiên được cung cấp.

prompt_embeds (`torch.Tensor`, *tùy chọn*) : Các vector nhúng văn bản đã được tạo trước. Có thể được sử dụng để dễ dàng điều chỉnh các đầu vào văn bản, *vd.* trọng số prompt. Nếu không được cung cấp, các vector nhúng văn bản sẽ được tạo từ đối số đầu vào `prompt`.

prompt_attention_mask (`torch.Tensor`, *tùy chọn*) : Mặt nạ chú ý (attention mask) được tạo trước cho các vector nhúng văn bản.

negative_prompt_embeds (`torch.FloatTensor`, *tùy chọn*) : Các vector nhúng văn bản âm đã được tạo trước. Đối với PixArt-Sigma, prompt âm này nên là "". Nếu không được cung cấp, negative_prompt_embeds sẽ được tạo từ đối số đầu vào `negative_prompt`.

negative_prompt_attention_mask (`torch.FloatTensor`, *tùy chọn*) : Mặt nạ chú ý (attention mask) được tạo trước cho các vector nhúng văn bản âm.

decode_timestep (`float`, mặc định là `0.0`) : Bước thời gian tại đó video được tạo ra sẽ được giải mã.

decode_noise_scale (`float`, mặc định là `None`) : Hệ số nội suy giữa nhiễu ngẫu nhiên và latents đã khử nhiễu tại bước thời gian giải mã.

output_type (`str`, *tùy chọn*, mặc định là `"pil"`) : Định dạng đầu ra của hình ảnh được tạo. Chọn giữa [PIL](https://pillow.readthedocs.io/en/stable/): `PIL.Image.Image` hoặc `np.array`.

return_dict (`bool`, *tùy chọn*, mặc định là `True`) : Có nên trả về một `~pipelines.ltx.LTXPipelineOutput` thay vì một tuple thông thường hay không.

attention_kwargs (`dict`, *tùy chọn*) : Một từ điển kwargs mà nếu được chỉ định sẽ được truyền đến `AttentionProcessor` như đã định nghĩa dưới `self.processor` trong [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).

callback_on_step_end (`Callable`, *tùy chọn*) : Một hàm được gọi vào cuối mỗi bước khử nhiễu trong quá trình suy luận. Hàm này được gọi với các đối số sau: `callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)`. `callback_kwargs` sẽ bao gồm một danh sách tất cả các tensor như được chỉ định bởi `callback_on_step_end_tensor_inputs`.

callback_on_step_end_tensor_inputs (`list`, *optional*) : Danh sách các đầu vào tensor cho hàm `callback_on_step_end`. Các tensor được chỉ định trong danh sách sẽ được truyền dưới dạng tham số `callback_kwargs`. Bạn chỉ có thể bao gồm các biến được liệt kê trong thuộc tính `._callback_tensor_inputs` của lớp pipeline của bạn.

max_sequence_length (`int` mặc định là `128 `) : Độ dài tối đa của chuỗi để sử dụng với `prompt`.

**Trả về:** `~pipelines.ltx.LTXPipelineOutput` hoặc `tuple`

Nếu `return_dict` là `True`, `~pipelines.ltx.LTXPipelineOutput` sẽ được trả về, ngược lại một `tuple` sẽ được trả về trong đó phần tử đầu tiên là một danh sách chứa các hình ảnh đã được tạo.

Hàm được gọi khi gọi pipeline cho việc sinh.

Ví dụ:
```py
>>> import torch
>>> from diffusers import LTXPipeline
>>> from diffusers.utils import export_to_video

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

>>> prompt = "A woman with long brown hair and light skin smiles at another woman with long blonde hair. The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek. The camera angle is a close-up, focused on the woman with brown hair's face. The lighting is warm and natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage"
>>> negative_prompt = "worst quality, inconsistent motion, blurry, jittery, distorted"

>>> video = pipe(
...     prompt=prompt,
...     negative_prompt=negative_prompt,
...     width=704,
...     height=480,
...     num_frames=161,
...     num_inference_steps=50,
... ).frames[0]
>>> export_to_video(video, "output.mp4", fps=24)
```

#### encode_prompt[[diffusers.LTXPipeline.encode_prompt]]

```python
encode_prompt(prompt: str | list[str], negative_prompt: str | list[str] | None = None, do_classifier_free_guidance: bool = True, num_videos_per_prompt: int = 1, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, prompt_attention_mask: typing.Optional[torch.Tensor] = None, negative_prompt_attention_mask: typing.Optional[torch.Tensor] = None, max_sequence_length: int = 128, device: typing.Optional[torch.device] = None, dtype: typing.Optional[torch.dtype] = None)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx.py#L283)

**Tham số:**

prompt (`str` hoặc `list[str]`, *tùy chọn*) : prompt cần được mã hóa

negative_prompt (`str` hoặc `list[str]`, *tùy chọn*) : Prompt hoặc các prompt không được dùng để hướng dẫn việc tạo ảnh. Nếu không được định nghĩa, bạn phải truyền `negative_prompt_embeds` thay thế. Bỏ qua khi không sử dụng guidance (tức là bị bỏ qua nếu `guidance_scale` nhỏ hơn `1`).

do_classifier_free_guidance (`bool`, *tùy chọn*, mặc định là `True`) : Có sử dụng classifier free guidance hay không.

num_videos_per_prompt (`int`, *optional*, mặc định là 1) : Số lượng video cần được tạo cho mỗi prompt. Thiết bị torch để đặt các embeddings kết quả lên

prompt_embeds (`torch.Tensor`, *tùy chọn*) : Các vector nhúng văn bản đã được tạo trước. Có thể được sử dụng để dễ dàng điều chỉnh các đầu vào văn bản, *vd.* trọng số prompt. Nếu không được cung cấp, các vector nhúng văn bản sẽ được tạo từ đối số đầu vào `prompt`.

negative_prompt_embeds (`torch.Tensor`, *tùy chọn*) : Các vector nhúng văn bản âm đã được tạo trước. Có thể được sử dụng để dễ dàng điều chỉnh các đầu vào văn bản, *vd.* trọng số prompt. Nếu không được cung cấp, negative_prompt_embeds sẽ được tạo từ đối số đầu vào `negative_prompt`.

device : (`torch.device`, *tùy chọn*): thiết bị torch

dtype : (`torch.dtype`, *tùy chọn*): torch dtype

Mã hóa prompt thành các trạng thái ẩn của text encoder.

## LTXImageToVideoPipeline[[diffusers.LTXImageToVideoPipeline]]

#### diffusers.LTXImageToVideoPipeline[[diffusers.LTXImageToVideoPipeline]]

```python
diffusers.LTXImageToVideoPipeline(scheduler: FlowMatchEulerDiscreteScheduler, vae: AutoencoderKLLTXVideo, text_encoder: T5EncoderModel, tokenizer: T5Tokenizer, transformer: LTXVideoTransformer3DModel)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx_image2video.py#L189)

**Tham số:**

transformer ([LTXVideoTransformer3DModel](/docs/diffusers/main/vi/api/models/ltx_video_transformer3d#diffusers.LTXVideoTransformer3DModel)) : Kiến trúc Transformer có điều kiện để khử nhiễu các latents video đã mã hóa.

scheduler ([FlowMatchEulerDiscreteScheduler](/docs/diffusers/main/vi/api/schedulers/flow_match_euler_discrete#diffusers.FlowMatchEulerDiscreteScheduler)) : Một trình lập lịch được sử dụng kết hợp với `transformer` để khử nhiễu các latent ảnh đã mã hóa.

vae ([AutoencoderKLLTXVideo](/docs/diffusers/main/vi/api/models/autoencoderkl_ltx_video#diffusers.AutoencoderKLLTXVideo)) : Mô hình Variational Auto-Encoder (VAE) để mã hóa và giải mã hình ảnh từ và sang các biểu diễn ẩn.

text_encoder (`T5EncoderModel`) : [T5](https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5EncoderModel), cụ thể là biến thể [google/t5-v1_1-xxl](https://huggingface.co/google/t5-v1_1-xxl).

tokenizer (`CLIPTokenizer`) : Tokenizer của lớp [CLIPTokenizer](https://huggingface.co/docs/transformers/en/model_doc/clip#transformers.CLIPTokenizer).

tokenizer (`T5TokenizerFast`) : Tokenizer thứ hai của lớp [T5TokenizerFast](https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5TokenizerFast).

Pipeline để tạo video từ ảnh.

Tham khảo: https://github.com/Lightricks/LTX-Video

#### __call__[[diffusers.LTXImageToVideoPipeline.__call__]]

```python
__call__(image: typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]] = None, prompt: str | list[str] = None, negative_prompt: str | list[str] | None = None, height: int = 512, width: int = 704, num_frames: int = 161, frame_rate: int = 25, num_inference_steps: int = 50, timesteps: list[int] = None, guidance_scale: float = 3, guidance_rescale: float = 0.0, num_videos_per_prompt: int | None = 1, generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = None, latents: typing.Optional[torch.Tensor] = None, prompt_embeds: typing.Optional[torch.Tensor] = None, prompt_attention_mask: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_attention_mask: typing.Optional[torch.Tensor] = None, decode_timestep: float | list[float] = 0.0, decode_noise_scale: float | list[float] | None = None, output_type: str | None = 'pil', return_dict: bool = True, attention_kwargs: dict[str, typing.Any] | None = None, callback_on_step_end: typing.Optional[typing.Callable[[int, int], NoneType]] = None, callback_on_step_end_tensor_inputs: list[str] = ['latents'], max_sequence_length: int = 128)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx_image2video.py#L596)

**Tham số:**

image (`PipelineImageInput`) : Ảnh đầu vào để điều kiện cho quá trình tạo. Phải là một ảnh, một danh sách các ảnh hoặc một `torch.Tensor`.

prompt (`str` hoặc `list[str]`, *tùy chọn*) : Prompt hoặc các prompt để hướng dẫn việc tạo ảnh. Nếu không được định nghĩa, bạn phải truyền `prompt_embeds` thay thế.

negative_prompt (`str` hoặc `list[str]`, *tùy chọn*) : Prompt hoặc các prompt không được dùng để định hướng việc tạo ảnh. Nếu không được định nghĩa, bạn phải truyền `negative_prompt_embeds` thay thế. Bỏ qua khi không sử dụng guidance (`guidance_scale < 1`).

height (`int`, mặc định là `512`) : Chiều cao của hình ảnh được tạo ra, tính bằng pixel. Giá trị này được đặt là 480 theo mặc định để đạt kết quả tốt nhất.

width (`int`, mặc định là `704`) : Độ rộng của hình ảnh được tạo ra, tính bằng pixel. Giá trị này được đặt là 848 theo mặc định để đạt kết quả tốt nhất.

num_frames (`int`, mặc định là `161`) : Số khung hình video cần tạo

frame_rate (`int`, mặc định là `25`) : Tốc độ khung hình mục tiêu của video được tạo ra.

num_inference_steps (`int`, *optional*, mặc định là 50) : Số bước khử nhiễu. Số bước khử nhiễu nhiều hơn thường dẫn đến hình ảnh có chất lượng cao hơn, với cái giá là suy luận chậm hơn.

timesteps (`list[int]`, *optional*) : Các bước thời gian (timesteps) tùy chỉnh để sử dụng cho quá trình khử nhiễu với các trình lập lịch (scheduler) hỗ trợ tham số `timesteps` trong phương thức `set_timesteps` của chúng. Nếu không được định nghĩa, hành vi mặc định khi `num_inference_steps` được truyền vào sẽ được sử dụng. Phải được sắp xếp theo thứ tự giảm dần.

guidance_scale (`float`, mặc định là `3 `) : Thang độ dẫn hướng như được định nghĩa trong [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598). `guidance_scale` được định nghĩa là `w` của phương trình 2. trong [Imagen Paper](https://huggingface.co/papers/2205.11487). Thang độ dẫn hướng được kích hoạt bằng cách đặt `guidance_scale > 1`. Thang độ dẫn hướng cao hơn khuyến khích tạo ra các hình ảnh gắn kết chặt chẽ với `prompt` văn bản, thường phải đánh đổi bằng chất lượng hình ảnh thấp hơn.

guidance_rescale (`float`, *tuỳ chọn*, mặc định là 0.0) : Hệ số rescale guidance được đề xuất bởi [Common Diffusion Noise Schedules and Sample Steps are Flawed](https://huggingface.co/papers/2305.08891) `guidance_scale` được định nghĩa là `φ` trong phương trình 16. của [Common Diffusion Noise Schedules and Sample Steps are Flawed](https://huggingface.co/papers/2305.08891). Hệ số rescale guidance nên khắc phục hiện tượng phơi sáng quá mức khi sử dụng zero terminal SNR.

num_videos_per_prompt (`int`, *tuỳ chọn*, mặc định là 1) : Số lượng video cần tạo cho mỗi prompt.

generator (`torch.Generator` hoặc `list[torch.Generator]`, *tùy chọn*) : Một hoặc một danh sách [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) để đảm bảo quá trình sinh là tất định.

latents (`torch.Tensor`, *tùy chọn*) : Các latents nhiễu đã được tạo trước, được lấy mẫu từ phân phối Gaussian, dùng làm đầu vào cho việc tạo ảnh. Có thể được sử dụng để tinh chỉnh cùng một quá trình tạo với các prompt khác nhau. Nếu không được cung cấp, một tensor latents sẽ được tạo ra bằng cách lấy mẫu sử dụng `generator` ngẫu nhiên được cung cấp.

prompt_embeds (`torch.Tensor`, *tùy chọn*) : Các vector nhúng văn bản đã được tạo trước. Có thể được sử dụng để dễ dàng điều chỉnh các đầu vào văn bản, *vd.* trọng số prompt. Nếu không được cung cấp, các vector nhúng văn bản sẽ được tạo từ đối số đầu vào `prompt`.

prompt_attention_mask (`torch.Tensor`, *tùy chọn*) : Mặt nạ chú ý (attention mask) được tạo trước cho các vector nhúng văn bản.

negative_prompt_embeds (`torch.FloatTensor`, *tùy chọn*) : Các vector nhúng văn bản âm đã được tạo trước. Đối với PixArt-Sigma, prompt âm này nên là "". Nếu không được cung cấp, negative_prompt_embeds sẽ được tạo từ đối số đầu vào `negative_prompt`.

negative_prompt_attention_mask (`torch.FloatTensor`, *tùy chọn*) : Mặt nạ chú ý (attention mask) được tạo trước cho các vector nhúng văn bản âm.

decode_timestep (`float`, mặc định là `0.0`) : Bước thời gian tại đó video được tạo ra sẽ được giải mã.

decode_noise_scale (`float`, mặc định là `None`) : Hệ số nội suy giữa nhiễu ngẫu nhiên và latents đã khử nhiễu tại bước thời gian giải mã.

output_type (`str`, *tùy chọn*, mặc định là `"pil"`) : Định dạng đầu ra của hình ảnh được tạo. Chọn giữa [PIL](https://pillow.readthedocs.io/en/stable/): `PIL.Image.Image` hoặc `np.array`.

return_dict (`bool`, *tùy chọn*, mặc định là `True`) : Có nên trả về một `~pipelines.ltx.LTXPipelineOutput` thay vì một tuple thông thường hay không.

attention_kwargs (`dict`, *tùy chọn*) : Một từ điển kwargs mà nếu được chỉ định sẽ được truyền đến `AttentionProcessor` như đã định nghĩa dưới `self.processor` trong [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).

callback_on_step_end (`Callable`, *tùy chọn*) : Một hàm được gọi vào cuối mỗi bước khử nhiễu trong quá trình suy luận. Hàm này được gọi với các đối số sau: `callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)`. `callback_kwargs` sẽ bao gồm một danh sách tất cả các tensor như được chỉ định bởi `callback_on_step_end_tensor_inputs`.

callback_on_step_end_tensor_inputs (`list`, *optional*) : Danh sách các đầu vào tensor cho hàm `callback_on_step_end`. Các tensor được chỉ định trong danh sách sẽ được truyền dưới dạng tham số `callback_kwargs`. Bạn chỉ có thể bao gồm các biến được liệt kê trong thuộc tính `._callback_tensor_inputs` của lớp pipeline của bạn.

max_sequence_length (`int` mặc định là `128 `) : Độ dài tối đa của chuỗi để sử dụng với `prompt`.

**Trả về:** `~pipelines.ltx.LTXPipelineOutput` hoặc `tuple`

Nếu `return_dict` là `True`, `~pipelines.ltx.LTXPipelineOutput` sẽ được trả về, ngược lại một `tuple` sẽ được trả về trong đó phần tử đầu tiên là một danh sách chứa các hình ảnh đã được tạo.

Hàm được gọi khi gọi pipeline cho việc sinh.

Ví dụ:
```py
>>> import torch
>>> from diffusers import LTXImageToVideoPipeline
>>> from diffusers.utils import export_to_video, load_image

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

>>> image = load_image(
...     "https://huggingface.co/datasets/a-r-r-o-w/tiny-meme-dataset-captioned/resolve/main/images/8.png"
... )
>>> prompt = "A young girl stands calmly in the foreground, looking directly at the camera, as a house fire rages in the background. Flames engulf the structure, with smoke billowing into the air. Firefighters in protective gear rush to the scene, a fire truck labeled '38' visible behind them. The girl's neutral expression contrasts sharply with the chaos of the fire, creating a poignant and emotionally charged scene."
>>> negative_prompt = "worst quality, inconsistent motion, blurry, jittery, distorted"

>>> video = pipe(
...     image=image,
...     prompt=prompt,
...     negative_prompt=negative_prompt,
...     width=704,
...     height=480,
...     num_frames=161,
...     num_inference_steps=50,
... ).frames[0]
>>> export_to_video(video, "output.mp4", fps=24)
```

#### encode_prompt[[diffusers.LTXImageToVideoPipeline.encode_prompt]]

```python
encode_prompt(prompt: str | list[str], negative_prompt: str | list[str] | None = None, do_classifier_free_guidance: bool = True, num_videos_per_prompt: int = 1, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, prompt_attention_mask: typing.Optional[torch.Tensor] = None, negative_prompt_attention_mask: typing.Optional[torch.Tensor] = None, max_sequence_length: int = 128, device: typing.Optional[torch.device] = None, dtype: typing.Optional[torch.dtype] = None)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx_image2video.py#L306)

**Tham số:**

prompt (`str` hoặc `list[str]`, *tùy chọn*) : prompt cần được mã hóa

negative_prompt (`str` hoặc `list[str]`, *tùy chọn*) : Prompt hoặc các prompt không được dùng để hướng dẫn việc tạo ảnh. Nếu không được định nghĩa, bạn phải truyền `negative_prompt_embeds` thay thế. Bỏ qua khi không sử dụng guidance (tức là bị bỏ qua nếu `guidance_scale` nhỏ hơn `1`).

do_classifier_free_guidance (`bool`, *tùy chọn*, mặc định là `True`) : Có sử dụng classifier free guidance hay không.

num_videos_per_prompt (`int`, *optional*, mặc định là 1) : Số lượng video cần được tạo cho mỗi prompt. Thiết bị torch để đặt các embeddings kết quả lên

prompt_embeds (`torch.Tensor`, *tùy chọn*) : Các vector nhúng văn bản đã được tạo trước. Có thể được sử dụng để dễ dàng điều chỉnh các đầu vào văn bản, *vd.* trọng số prompt. Nếu không được cung cấp, các vector nhúng văn bản sẽ được tạo từ đối số đầu vào `prompt`.

negative_prompt_embeds (`torch.Tensor`, *tùy chọn*) : Các vector nhúng văn bản âm đã được tạo trước. Có thể được sử dụng để dễ dàng điều chỉnh các đầu vào văn bản, *vd.* trọng số prompt. Nếu không được cung cấp, negative_prompt_embeds sẽ được tạo từ đối số đầu vào `negative_prompt`.

device : (`torch.device`, *tùy chọn*): thiết bị torch

dtype : (`torch.dtype`, *tùy chọn*): torch dtype

Mã hóa prompt thành các trạng thái ẩn của text encoder.

## LTXConditionPipeline[[diffusers.LTXConditionPipeline]]

#### diffusers.LTXConditionPipeline[[diffusers.LTXConditionPipeline]]

```python
diffusers.LTXConditionPipeline(scheduler: FlowMatchEulerDiscreteScheduler, vae: AutoencoderKLLTXVideo, text_encoder: T5EncoderModel, tokenizer: T5Tokenizer, transformer: LTXVideoTransformer3DModel)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx_condition.py#L252)

**Tham số:**

transformer ([LTXVideoTransformer3DModel](/docs/diffusers/main/vi/api/models/ltx_video_transformer3d#diffusers.LTXVideoTransformer3DModel)) : Kiến trúc Transformer có điều kiện để khử nhiễu các latents video đã mã hóa.

scheduler ([FlowMatchEulerDiscreteScheduler](/docs/diffusers/main/vi/api/schedulers/flow_match_euler_discrete#diffusers.FlowMatchEulerDiscreteScheduler)) : Một trình lập lịch được sử dụng kết hợp với `transformer` để khử nhiễu các latent ảnh đã mã hóa.

vae ([AutoencoderKLLTXVideo](/docs/diffusers/main/vi/api/models/autoencoderkl_ltx_video#diffusers.AutoencoderKLLTXVideo)) : Mô hình Variational Auto-Encoder (VAE) để mã hóa và giải mã hình ảnh từ và sang các biểu diễn ẩn.

text_encoder (`T5EncoderModel`) : [T5](https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5EncoderModel), cụ thể là biến thể [google/t5-v1_1-xxl](https://huggingface.co/google/t5-v1_1-xxl).

tokenizer (`CLIPTokenizer`) : Tokenizer của lớp [CLIPTokenizer](https://huggingface.co/docs/transformers/en/model_doc/clip#transformers.CLIPTokenizer).

tokenizer (`T5TokenizerFast`) : Tokenizer thứ hai của lớp [T5TokenizerFast](https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5TokenizerFast).

Pipeline để tạo video từ văn bản/hình ảnh/video.

Tham khảo: https://github.com/Lightricks/LTX-Video

#### __call__[[diffusers.LTXConditionPipeline.__call__]]

```python
__call__(conditions: diffusers.pipelines.ltx.pipeline_ltx_condition.LTXVideoCondition | list[diffusers.pipelines.ltx.pipeline_ltx_condition.LTXVideoCondition] = None, image: typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor], list[typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]]]] = None, video: list[typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]]] = None, frame_index: int | list[int] = 0, strength: float | list[float] = 1.0, denoise_strength: float = 1.0, prompt: str | list[str] = None, negative_prompt: str | list[str] | None = None, height: int = 512, width: int = 704, num_frames: int = 161, frame_rate: int = 25, num_inference_steps: int = 50, timesteps: list[int] = None, guidance_scale: float = 3, guidance_rescale: float = 0.0, image_cond_noise_scale: float = 0.15, num_videos_per_prompt: int | None = 1, generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = None, latents: typing.Optional[torch.Tensor] = None, prompt_embeds: typing.Optional[torch.Tensor] = None, prompt_attention_mask: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_attention_mask: typing.Optional[torch.Tensor] = None, decode_timestep: float | list[float] = 0.0, decode_noise_scale: float | list[float] | None = None, output_type: str | None = 'pil', return_dict: bool = True, attention_kwargs: dict[str, typing.Any] | None = None, callback_on_step_end: typing.Optional[typing.Callable[[int, int], NoneType]] = None, callback_on_step_end_tensor_inputs: list[str] = ['latents'], max_sequence_length: int = 256)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx_condition.py#L848)

**Tham số:**

conditions (`list[LTXVideoCondition], *optional*`) : Danh sách các mục điều kiện khung hình cho việc tạo video. Nếu không được cung cấp, các điều kiện sẽ được tạo bằng cách sử dụng `image`, `video`, `frame_index` và `strength`.

image (`PipelineImageInput` hoặc `list[PipelineImageInput]`, *tùy chọn*) : Ảnh hoặc các ảnh để điều kiện cho việc tạo video. Nếu không được cung cấp, người dùng phải truyền `video` hoặc `conditions`.

video (`list[PipelineImageInput]`, *tùy chọn*) : Video để điều kiện hóa quá trình tạo video. Nếu không được cung cấp, người dùng phải truyền `image` hoặc `conditions`.

frame_index (`int` hoặc `list[int]`, *tùy chọn*) : Chỉ số khung hình hoặc các chỉ số khung hình mà tại đó hình ảnh hoặc video sẽ có tác động có điều kiện đến việc tạo video. Nếu không được cung cấp, người dùng phải truyền `conditions`.

strength (`float` hoặc `list[float]`, *tùy chọn*) : Độ mạnh hoặc các độ mạnh của hiệu ứng điều kiện. Nếu không được cung cấp, bạn phải truyền `conditions`.

denoise_strength (`float`, mặc định là `1.0`) : Cường độ của nhiễu được thêm vào các latents để chỉnh sửa. Cường độ cao hơn dẫn đến việc thêm nhiều nhiễu hơn vào các latents, do đó tạo ra nhiều khác biệt hơn giữa video gốc và video được tạo ra. Điều này hữu ích cho việc chỉnh sửa video-to-video.

prompt (`str` hoặc `list[str]`, *tùy chọn*) : Prompt hoặc các prompt để hướng dẫn việc tạo ảnh. Nếu không được định nghĩa, bạn phải truyền `prompt_embeds` thay thế.

negative_prompt (`str` hoặc `list[str]`, *tùy chọn*) : Prompt hoặc các prompt không được dùng để định hướng việc tạo ảnh. Nếu không được định nghĩa, bạn phải truyền `negative_prompt_embeds` thay thế. Bỏ qua khi không sử dụng guidance (`guidance_scale < 1`).

height (`int`, mặc định là `512`) : Chiều cao của hình ảnh được tạo ra, tính bằng pixel. Giá trị này được đặt là 480 theo mặc định để đạt kết quả tốt nhất.

width (`int`, mặc định là `704`) : Độ rộng của hình ảnh được tạo ra, tính bằng pixel. Giá trị này được đặt là 848 theo mặc định để đạt kết quả tốt nhất.

num_frames (`int`, mặc định là `161`) : Số khung hình video cần tạo

frame_rate (`int`, mặc định là `25`) : Tốc độ khung hình mục tiêu của video được tạo ra.

num_inference_steps (`int`, *optional*, mặc định là 50) : Số bước khử nhiễu. Số bước khử nhiễu nhiều hơn thường dẫn đến hình ảnh có chất lượng cao hơn, với cái giá là suy luận chậm hơn.

timesteps (`list[int]`, *optional*) : Các bước thời gian (timesteps) tùy chỉnh để sử dụng cho quá trình khử nhiễu với các trình lập lịch (scheduler) hỗ trợ tham số `timesteps` trong phương thức `set_timesteps` của chúng. Nếu không được định nghĩa, hành vi mặc định khi `num_inference_steps` được truyền vào sẽ được sử dụng. Phải được sắp xếp theo thứ tự giảm dần.

guidance_scale (`float`, mặc định là `3 `) : Thang độ dẫn hướng như được định nghĩa trong [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598). `guidance_scale` được định nghĩa là `w` của phương trình 2. trong [Imagen Paper](https://huggingface.co/papers/2205.11487). Thang độ dẫn hướng được kích hoạt bằng cách đặt `guidance_scale > 1`. Thang độ dẫn hướng cao hơn khuyến khích tạo ra các hình ảnh gắn kết chặt chẽ với `prompt` văn bản, thường phải đánh đổi bằng chất lượng hình ảnh thấp hơn.

guidance_rescale (`float`, *tuỳ chọn*, mặc định là 0.0) : Hệ số rescale guidance được đề xuất bởi [Common Diffusion Noise Schedules and Sample Steps are Flawed](https://huggingface.co/papers/2305.08891) `guidance_scale` được định nghĩa là `φ` trong phương trình 16. của [Common Diffusion Noise Schedules and Sample Steps are Flawed](https://huggingface.co/papers/2305.08891). Hệ số rescale guidance nên khắc phục hiện tượng phơi sáng quá mức khi sử dụng zero terminal SNR.

image_cond_noise_scale (`float`, mặc định là `0.15`) : Thang độ của nhiễu được thêm vào các latents của ảnh điều kiện.

num_videos_per_prompt (`int`, *tuỳ chọn*, mặc định là 1) : Số lượng video cần tạo cho mỗi prompt.

generator (`torch.Generator` hoặc `list[torch.Generator]`, *tùy chọn*) : Một hoặc một danh sách [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) để đảm bảo quá trình sinh là tất định.

latents (`torch.Tensor`, *tùy chọn*) : Các latents nhiễu đã được tạo trước, được lấy mẫu từ phân phối Gaussian, dùng làm đầu vào cho việc tạo ảnh. Có thể được sử dụng để tinh chỉnh cùng một quá trình tạo với các prompt khác nhau. Nếu không được cung cấp, một tensor latents sẽ được tạo ra bằng cách lấy mẫu sử dụng `generator` ngẫu nhiên được cung cấp.

prompt_embeds (`torch.Tensor`, *tùy chọn*) : Các vector nhúng văn bản đã được tạo trước. Có thể được sử dụng để dễ dàng điều chỉnh các đầu vào văn bản, *vd.* trọng số prompt. Nếu không được cung cấp, các vector nhúng văn bản sẽ được tạo từ đối số đầu vào `prompt`.

prompt_attention_mask (`torch.Tensor`, *tùy chọn*) : Mặt nạ chú ý (attention mask) được tạo trước cho các vector nhúng văn bản.

negative_prompt_embeds (`torch.FloatTensor`, *tùy chọn*) : Các vector nhúng văn bản âm đã được tạo trước. Đối với PixArt-Sigma, prompt âm này nên là "". Nếu không được cung cấp, negative_prompt_embeds sẽ được tạo từ đối số đầu vào `negative_prompt`.

negative_prompt_attention_mask (`torch.FloatTensor`, *tùy chọn*) : Mặt nạ chú ý (attention mask) được tạo trước cho các vector nhúng văn bản âm.

decode_timestep (`float`, mặc định là `0.0`) : Bước thời gian tại đó video được tạo ra sẽ được giải mã.

decode_noise_scale (`float`, mặc định là `None`) : Hệ số nội suy giữa nhiễu ngẫu nhiên và latents đã khử nhiễu tại bước thời gian giải mã.

output_type (`str`, *tùy chọn*, mặc định là `"pil"`) : Định dạng đầu ra của hình ảnh được tạo. Chọn giữa [PIL](https://pillow.readthedocs.io/en/stable/): `PIL.Image.Image` hoặc `np.array`.

return_dict (`bool`, *tùy chọn*, mặc định là `True`) : Có nên trả về một `~pipelines.ltx.LTXPipelineOutput` thay vì một tuple thông thường hay không.

attention_kwargs (`dict`, *tùy chọn*) : Một từ điển kwargs mà nếu được chỉ định sẽ được truyền đến `AttentionProcessor` như đã định nghĩa dưới `self.processor` trong [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).

callback_on_step_end (`Callable`, *tùy chọn*) : Một hàm được gọi vào cuối mỗi bước khử nhiễu trong quá trình suy luận. Hàm này được gọi với các đối số sau: `callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)`. `callback_kwargs` sẽ bao gồm một danh sách tất cả các tensor như được chỉ định bởi `callback_on_step_end_tensor_inputs`.

callback_on_step_end_tensor_inputs (`list`, *optional*) : Danh sách các đầu vào tensor cho hàm `callback_on_step_end`. Các tensor được chỉ định trong danh sách sẽ được truyền dưới dạng tham số `callback_kwargs`. Bạn chỉ có thể bao gồm các biến được liệt kê trong thuộc tính `._callback_tensor_inputs` của lớp pipeline của bạn.

max_sequence_length (`int` mặc định là `128 `) : Độ dài tối đa của chuỗi để sử dụng với `prompt`.

**Trả về:** `~pipelines.ltx.LTXPipelineOutput` hoặc `tuple`

Nếu `return_dict` là `True`, `~pipelines.ltx.LTXPipelineOutput` sẽ được trả về, ngược lại một `tuple` sẽ được trả về trong đó phần tử đầu tiên là một danh sách chứa các hình ảnh đã được tạo.

Hàm được gọi khi gọi pipeline cho việc sinh.

Ví dụ:
```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)
```

#### add_noise_to_image_conditioning_latents[[diffusers.LTXConditionPipeline.add_noise_to_image_conditioning_latents]]

```python
add_noise_to_image_conditioning_latents(t: float, init_latents: Tensor, latents: Tensor, noise_scale: float, conditioning_mask: Tensor, generator, eps = 1e-06)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx_condition.py#L646)

Thêm nhiễu phụ thuộc vào bước thời gian vào các latent điều kiện cứng. Điều này giúp cải thiện tính liên tục của chuyển động, đặc biệt khi điều kiện dựa trên một khung hình duy nhất.

#### encode_prompt[[diffusers.LTXConditionPipeline.encode_prompt]]

```python
encode_prompt(prompt: str | list[str], negative_prompt: str | list[str] | None = None, do_classifier_free_guidance: bool = True, num_videos_per_prompt: int = 1, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, prompt_attention_mask: typing.Optional[torch.Tensor] = None, negative_prompt_attention_mask: typing.Optional[torch.Tensor] = None, max_sequence_length: int = 256, device: typing.Optional[torch.device] = None, dtype: typing.Optional[torch.dtype] = None)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx_condition.py#L369)

**Tham số:**

prompt (`str` hoặc `list[str]`, *tùy chọn*) : prompt cần được mã hóa

negative_prompt (`str` hoặc `list[str]`, *tùy chọn*) : Prompt hoặc các prompt không được dùng để hướng dẫn việc tạo ảnh. Nếu không được định nghĩa, bạn phải truyền `negative_prompt_embeds` thay thế. Bỏ qua khi không sử dụng guidance (tức là bị bỏ qua nếu `guidance_scale` nhỏ hơn `1`).

do_classifier_free_guidance (`bool`, *tùy chọn*, mặc định là `True`) : Có sử dụng classifier free guidance hay không.

num_videos_per_prompt (`int`, *optional*, mặc định là 1) : Số lượng video cần được tạo cho mỗi prompt. Thiết bị torch để đặt các embeddings kết quả lên

prompt_embeds (`torch.Tensor`, *tùy chọn*) : Các vector nhúng văn bản đã được tạo trước. Có thể được sử dụng để dễ dàng điều chỉnh các đầu vào văn bản, *vd.* trọng số prompt. Nếu không được cung cấp, các vector nhúng văn bản sẽ được tạo từ đối số đầu vào `prompt`.

negative_prompt_embeds (`torch.Tensor`, *tùy chọn*) : Các vector nhúng văn bản âm đã được tạo trước. Có thể được sử dụng để dễ dàng điều chỉnh các đầu vào văn bản, *vd.* trọng số prompt. Nếu không được cung cấp, negative_prompt_embeds sẽ được tạo từ đối số đầu vào `negative_prompt`.

device : (`torch.device`, *tùy chọn*): thiết bị torch

dtype : (`torch.dtype`, *tùy chọn*): torch dtype

Mã hóa prompt thành các trạng thái ẩn của text encoder.

#### trim_conditioning_sequence[[diffusers.LTXConditionPipeline.trim_conditioning_sequence]]

```python
trim_conditioning_sequence(start_frame: int, sequence_num_frames: int, target_num_frames: int)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx_condition.py#L629)

**Tham số:**

start_frame (int) : Số khung đích của khung đầu tiên trong chuỗi.

sequence_num_frames (int) : Số lượng khung hình trong chuỗi.

target_num_frames (int) : Số khung hình mục tiêu trong video được tạo ra.

**Trả về:** `int`

chiều dài chuỗi đã cập nhật

Cắt ngắn một chuỗi điều kiện xuống số khung hình được phép.

## LTXLatentUpsamplePipeline[[diffusers.LTXLatentUpsamplePipeline]]

#### diffusers.LTXLatentUpsamplePipeline[[diffusers.LTXLatentUpsamplePipeline]]

```python
diffusers.LTXLatentUpsamplePipeline(vae: AutoencoderKLLTXVideo, latent_upsampler: LTXLatentUpsamplerModel)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx_latent_upsample.py#L44)

#### __call__[[diffusers.LTXLatentUpsamplePipeline.__call__]]

```python
__call__(video: list[typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]]] | None = None, height: int = 512, width: int = 704, latents: typing.Optional[torch.Tensor] = None, decode_timestep: float | list[float] = 0.0, decode_noise_scale: float | list[float] | None = None, adain_factor: float = 0.0, tone_map_compression_ratio: float = 0.0, generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = None, output_type: str | None = 'pil', return_dict: bool = True)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx_latent_upsample.py#L188)

**Tham số:**

video (`list[PipelineImageInput]`, *tùy chọn*) : Các khung hình video đầu vào để tăng mẫu. Loại trừ lẫn nhau với `latents`.

height (`int`, mặc định là `512`) : Chiều cao của đầu ra được lấy mẫu lên, tính bằng pixel.

width (`int`, mặc định là `704`) : Độ rộng tính bằng pixel của đầu ra đã được tăng mẫu.

latents (`torch.Tensor`, *tùy chọn*) : Các video latents đã mã hóa trước để upsample. Loại trừ lẫn nhau với `video`.

decode_timestep (`float` hoặc `list[float]`, mặc định là `0.0`) : Bước thời gian tại đó các latents được upsample sẽ được giải mã.

decode_noise_scale (`float` hoặc `list[float]`, *tùy chọn*) : Hệ số nội suy giữa nhiễu ngẫu nhiên và latents đã khử nhiễu tại bước thời gian giải mã.

adain_factor (`float`, mặc định là `0.0`) : Độ mạnh của việc khớp thống kê AdaIN được áp dụng cho các latents đã được upsample.

tone_map_compression_ratio (`float`, mặc định là `0.0`) : Tỷ lệ nén được sử dụng để tone mapping các latents đã được upsample. Phải nằm trong khoảng [0, 1].

generator (`torch.Generator` hoặc `list[torch.Generator]`, *tùy chọn*) : Một [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) để đảm bảo quá trình sinh là tất định.

output_type (`str`, *tùy chọn*, mặc định là `"pil"`) : Định dạng đầu ra của video được tạo. Chọn giữa `PIL.Image`, `np.array` hoặc `latent`.

return_dict (`bool`, *tùy chọn*, mặc định là `True`) : Có nên trả về một `~pipelines.ltx.LTXPipelineOutput` thay vì một tuple thông thường hay không.

**Trả về:** `~pipelines.ltx.LTXPipelineOutput` hoặc `tuple`

`~pipelines.ltx.LTXPipelineOutput` nếu `return_dict` là True, ngược lại là một `tuple`. Khi trả về tuple, phần tử đầu tiên là video đã được upsample (hoặc latents nếu `output_type="latent"`).

Hàm được gọi khi gọi pipeline để tăng độ phân giải tiềm ẩn (latent upsampling).

#### adain_filter_latent[[diffusers.LTXLatentUpsamplePipeline.adain_filter_latent]]

```python
adain_filter_latent(latents: Tensor, reference_latents: Tensor, factor: float = 1.0)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx_latent_upsample.py#L94)

**Tham số:**

latents (`torch.Tensor`) : Latent đầu vào cần chuẩn hóa

reference_latents (`torch.Tensor`) : Các latents tham chiếu cung cấp thống kê phong cách.

factor (`float`) : Hệ số trộn giữa latent gốc và latent đã biến đổi. Khoảng: -10.0 đến 10.0, Mặc định: 1.0

**Trả về:** `torch.Tensor`

Tensor ẩn đã được biến đổi

Áp dụng Chuẩn hóa Thực thể Thích ứng (AdaIN) lên một tensor ẩn dựa trên các thống kê từ một tensor ẩn tham chiếu.

#### tone_map_latents[[diffusers.LTXLatentUpsamplePipeline.tone_map_latents]]

```python
tone_map_latents(latents: Tensor, compression: float)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_ltx_latent_upsample.py#L122)

**Tham số:**

latents : torch.Tensor Tensor ẩn đầu vào với hình dạng tùy ý. Được kỳ vọng nằm trong khoảng [-1, 1] hoặc [0, 1].

compression : float Cường độ nén trong khoảng [0, 1]. - 0.0: Không ánh xạ tông (biến đổi đồng nhất) - 1.0: Hiệu ứng nén toàn phần

**Trả về:**

torch.Tensor Tensor latent đã được tone-map có cùng hình dạng với đầu vào.

Áp dụng một hàm ánh xạ tông phi tuyến lên các giá trị tiềm ẩn để giảm phạm vi động của chúng một cách mượt mà về mặt cảm nhận bằng cách sử dụng nén dựa trên sigmoid.

Điều này hữu ích để chuẩn hóa các latent có phương sai cao hoặc để điều kiện hóa đầu ra trong quá trình tạo, đặc biệt khi kiểm soát hành vi động bằng hệ số `compression`.

## LTXPipelineOutput[[diffusers.pipelines.ltx.pipeline_output.LTXPipelineOutput]]

#### diffusers.pipelines.ltx.pipeline_output.LTXPipelineOutput[[diffusers.pipelines.ltx.pipeline_output.LTXPipelineOutput]]

```python
diffusers.pipelines.ltx.pipeline_output.LTXPipelineOutput(frames: Tensor)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ltx/pipeline_output.py#L9)

**Tham số:**

frames (`torch.Tensor`, `np.ndarray`, hoặc list[list[PIL.Image.Image]]) : danh sách các đầu ra video - Có thể là một danh sách lồng nhau có độ dài `batch_size,` trong đó mỗi danh sách con chứa các chuỗi hình ảnh PIL đã khử nhiễu có độ dài `num_frames.` Nó cũng có thể là một mảng NumPy hoặc tensor Torch có hình dạng `(batch_size, num_frames, channels, height, width)`.

Lớp đầu ra cho các pipeline LTX.

