|
| 1 | +<!-- Copyright 2024 The HuggingFace Team. All rights reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. --> |
| 14 | + |
| 15 | +# LTX |
| 16 | + |
| 17 | +[LTX Video](https://huggingface.co/Lightricks/LTX-Video) is the first DiT-based video generation model capable of generating high-quality videos in real-time. It produces 24 FPS videos at a 768x512 resolution faster than they can be watched. Trained on a large-scale dataset of diverse videos, the model generates high-resolution videos with realistic and varied content. We provide a model for both text-to-video as well as image + text-to-video usecases. |
| 18 | + |
| 19 | +<Tip> |
| 20 | + |
| 21 | +Make sure to check out the Schedulers [guide](../../using-diffusers/schedulers.md) to learn how to explore the tradeoff between scheduler speed and quality, and see the [reuse components across pipelines](../../using-diffusers/loading.md#reuse-a-pipeline) section to learn how to efficiently load the same components into multiple pipelines. |
| 22 | + |
| 23 | +</Tip> |
| 24 | + |
| 25 | +## Loading Single Files |
| 26 | + |
| 27 | +Loading the original LTX Video checkpoints is also possible with [`~ModelMixin.from_single_file`]. |
| 28 | + |
| 29 | +```python |
| 30 | +import torch |
| 31 | +from diffusers import AutoencoderKLLTXVideo, LTXImageToVideoPipeline, LTXVideoTransformer3DModel |
| 32 | + |
| 33 | +single_file_url = "https://huggingface.co/Lightricks/LTX-Video/ltx-video-2b-v0.9.safetensors" |
| 34 | +transformer = LTXVideoTransformer3DModel.from_single_file(single_file_url, torch_dtype=torch.bfloat16) |
| 35 | +vae = AutoencoderKLLTXVideo.from_single_file(single_file_url, torch_dtype=torch.bfloat16) |
| 36 | +pipe = LTXImageToVideoPipeline.from_pretrained("Lightricks/LTX-Video", transformer=transformer, vae=vae, torch_dtype=torch.bfloat16) |
| 37 | + |
| 38 | +# ... inference code ... |
| 39 | +``` |
| 40 | + |
| 41 | +Alternatively, the pipeline can be used to load the weights with [~FromSingleFileMixin.from_single_file`]. |
| 42 | + |
| 43 | +```python |
| 44 | +import torch |
| 45 | +from diffusers import LTXImageToVideoPipeline |
| 46 | +from transformers import T5EncoderModel, T5Tokenizer |
| 47 | + |
| 48 | +single_file_url = "https://huggingface.co/Lightricks/LTX-Video/ltx-video-2b-v0.9.safetensors" |
| 49 | +text_encoder = T5EncoderModel.from_pretrained("Lightricks/LTX-Video", subfolder="text_encoder", torch_dtype=torch.bfloat16) |
| 50 | +tokenizer = T5Tokenizer.from_pretrained("Lightricks/LTX-Video", subfolder="tokenizer", torch_dtype=torch.bfloat16) |
| 51 | +pipe = LTXImageToVideoPipeline.from_single_file(single_file_url, text_encoder=text_encoder, tokenizer=tokenizer, torch_dtype=torch.bfloat16) |
| 52 | +``` |
| 53 | + |
| 54 | +## LTXPipeline |
| 55 | + |
| 56 | +[[autodoc]] LTXPipeline |
| 57 | + - all |
| 58 | + - __call__ |
| 59 | + |
| 60 | +## LTXImageToVideoPipeline |
| 61 | + |
| 62 | +[[autodoc]] LTXImageToVideoPipeline |
| 63 | + - all |
| 64 | + - __call__ |
| 65 | + |
| 66 | +## LTXPipelineOutput |
| 67 | + |
| 68 | +[[autodoc]] pipelines.ltx.pipeline_output.LTXPipelineOutput |
0 commit comments