File size: 885 Bytes
708a6ea
 
59b5bd8
708a6ea
 
 
 
05b87e0
 
 
 
 
1b1d1c1
 
05b87e0
aea3b85
57da289
05b87e0
 
f53286d
1b1d1c1
05b87e0
d4160b5
 
8811d6d
d4160b5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import torch

from diffusers import LTXPipeline, LTXImageToVideoPipeline, LTXVideoTransformer3DModel, GGUFQuantizationConfig, AutoencoderKLLTXVideo


device = "cuda" if torch.cuda.is_available() else "cpu"

ckpt_path = (
    "https://huggingface.co/city96/LTX-Video-gguf/blob/main/ltx-video-2b-v0.9-Q3_K_S.gguf"
)
transformer = LTXVideoTransformer3DModel.from_single_file(
    ckpt_path,
    quantization_config=GGUFQuantizationConfig(compute_dtype=torch.float32),
    torch_dtype=torch.float32,
)
vae = AutoencoderKLLTXVideo.from_single_file("https://huggingface.co/Lightricks/LTX-Video/ltx-video-2b-v0.9.safetensors", torch_dtype=torch.float32)
t2v_pipe = LTXPipeline.from_pretrained(
    "Lightricks/LTX-Video",
    transformer=transformer,
    vae=vae,
    torch_dtype=torch.float32,
)
t2v_pipe.to(device)

i2v_pipe = LTXImageToVideoPipeline.from_pipe(t2v_pipe)
i2v_pipe.to(device)