From e68092a4718a775568fae009e50162425eefbb1e Mon Sep 17 00:00:00 2001 From: Sayak Paul Date: Mon, 16 Dec 2024 12:24:14 +0530 Subject: [PATCH] [docs] minor stuff to ltx video docs. (#10229) minor stuff to ltx video docs. --- docs/source/en/api/pipelines/ltx_video.md | 24 +++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/docs/source/en/api/pipelines/ltx_video.md b/docs/source/en/api/pipelines/ltx_video.md index 162e1334ce9a..ac2b1c95b5b1 100644 --- a/docs/source/en/api/pipelines/ltx_video.md +++ b/docs/source/en/api/pipelines/ltx_video.md @@ -31,14 +31,18 @@ import torch from diffusers import AutoencoderKLLTXVideo, LTXImageToVideoPipeline, LTXVideoTransformer3DModel single_file_url = "https://huggingface.co/Lightricks/LTX-Video/ltx-video-2b-v0.9.safetensors" -transformer = LTXVideoTransformer3DModel.from_single_file(single_file_url, torch_dtype=torch.bfloat16) +transformer = LTXVideoTransformer3DModel.from_single_file( + single_file_url, torch_dtype=torch.bfloat16 +) vae = AutoencoderKLLTXVideo.from_single_file(single_file_url, torch_dtype=torch.bfloat16) -pipe = LTXImageToVideoPipeline.from_pretrained("Lightricks/LTX-Video", transformer=transformer, vae=vae, torch_dtype=torch.bfloat16) +pipe = LTXImageToVideoPipeline.from_pretrained( + "Lightricks/LTX-Video", transformer=transformer, vae=vae, torch_dtype=torch.bfloat16 +) # ... inference code ... ``` -Alternatively, the pipeline can be used to load the weights with [~FromSingleFileMixin.from_single_file`]. +Alternatively, the pipeline can be used to load the weights with [`~FromSingleFileMixin.from_single_file`]. ```python import torch @@ -46,11 +50,19 @@ from diffusers import LTXImageToVideoPipeline from transformers import T5EncoderModel, T5Tokenizer single_file_url = "https://huggingface.co/Lightricks/LTX-Video/ltx-video-2b-v0.9.safetensors" -text_encoder = T5EncoderModel.from_pretrained("Lightricks/LTX-Video", subfolder="text_encoder", torch_dtype=torch.bfloat16) -tokenizer = T5Tokenizer.from_pretrained("Lightricks/LTX-Video", subfolder="tokenizer", torch_dtype=torch.bfloat16) -pipe = LTXImageToVideoPipeline.from_single_file(single_file_url, text_encoder=text_encoder, tokenizer=tokenizer, torch_dtype=torch.bfloat16) +text_encoder = T5EncoderModel.from_pretrained( + "Lightricks/LTX-Video", subfolder="text_encoder", torch_dtype=torch.bfloat16 +) +tokenizer = T5Tokenizer.from_pretrained( + "Lightricks/LTX-Video", subfolder="tokenizer", torch_dtype=torch.bfloat16 +) +pipe = LTXImageToVideoPipeline.from_single_file( + single_file_url, text_encoder=text_encoder, tokenizer=tokenizer, torch_dtype=torch.bfloat16 +) ``` +Refer to [this section](https://huggingface.co/docs/diffusers/main/en/api/pipelines/cogvideox#memory-optimization) to learn more about optimizing memory consumption. + ## LTXPipeline [[autodoc]] LTXPipeline