Lightricks/LTX-Video-0.9.5
Lightricks
Texto a video
LTX-Video-0.9.5 es un modelo de generación de video basado en difusión para texto a video e imagen más texto a video. Está desarrollado por Lightricks y pertenece a la familia LTX-Video, orientada a generar videos de alta resolución con movimiento realista y contenido variado. El modelo trabaja mejor con prompts detallados en inglés, resoluciones por debajo de 720 x 1280 y cantidades de fotogramas inferiores a 257.
Como usar
Instalación y uso rápido con Diffusers:
pip install -U diffusers transformers accelerate
import torch
from diffusers import DiffusionPipeline
# switch to "mps" for apple devices
pipe = DiffusionPipeline.from_pretrained("Lightricks/LTX-Video-0.9.5", dtype=torch.bfloat16, device_map="cuda")
prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
image = pipe(prompt).images[0]
Ejecución local desde el repositorio oficial:
git clone https://github.com/Lightricks/LTX-Video.git
cd LTX-Video
python -m venv env
source env/bin/activate
python -m pip install -e .\[inference-script\]
Texto a video:
python inference.py --prompt "PROMPT" --height HEIGHT --width WIDTH --num_frames NUM_FRAMES --seed SEED --pipeline_config ltxv-13b-0.9.7-dev.yaml
Imagen a video:
python inference.py --prompt "PROMPT" --input_image_path IMAGE_PATH --height HEIGHT --width WIDTH --num_frames NUM_FRAMES --seed SEED --pipeline_config ltxv-13b-0.9.7-dev.yaml
Ejemplo con Diffusers para texto a video:
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)
Ejemplo con Diffusers para imagen a video:
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)
Funcionalidades
- Generación de video desde texto.
- Generación de video desde imagen y texto.
- Modelo basado en difusión para video.
- Compatible con Diffusers y ComfyUI.
- Usa checkpoints en formato Safetensors.
- Optimizado para resoluciones divisibles por 32 y fotogramas divisibles por 8 + 1.
- Puede generar videos de 30 FPS en la familia LTX-Video, con variantes más recientes orientadas a mayor calidad o menor VRAM.
Casos de uso
- Crear videos cortos a partir de descripciones textuales detalladas.
- Animar una imagen inicial siguiendo una instrucción textual.
- Prototipar clips cinematográficos, escenas naturales, planos urbanos o escenas con personajes.
- Integrar generación de video en flujos locales con Diffusers, ComfyUI o scripts de inferencia.
- Experimentar con variantes de LTX-Video que equilibran calidad, velocidad y consumo de VRAM.