Spaces:
Running
on
Zero
Running
on
Zero
1inkusFace
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -26,23 +26,16 @@ HF_TOKEN = os.getenv("HF_TOKEN")
|
|
26 |
MAX_SEED = np.iinfo(np.int64).max
|
27 |
|
28 |
single_file_url = "https://huggingface.co/Lightricks/LTX-Video/ltx-video-2b-v0.9.1.safetensors"
|
29 |
-
#vae_url = 'https://huggingface.co/spacepxl/ltx-video-0.9-vae-finetune/ltx-video-v0.9-vae_finetune_decoder_111k_smooth.safetensors'
|
30 |
-
|
31 |
-
|
32 |
-
#vae = AutoencoderKLLTXVideo.from_single_file(vae_url,token=HF_TOKEN)
|
33 |
-
#vaeX = AutoencoderKLLTXVideo.from_pretrained("Lightricks/LTX-Video",subfolder='vae',token=HF_TOKEN)
|
34 |
|
35 |
pipe = LTXImageToVideoPipeline.from_pretrained(
|
36 |
-
|
37 |
-
'a-r-r-o-w/LTX-Video-0.9.1-diffusers',
|
38 |
token=HF_TOKEN,
|
39 |
-
|
40 |
text_encoder=None,
|
41 |
).to(torch.device("cuda"),torch.bfloat16)
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
#transformer = LTXVideoTransformer3DModel.from_single_file(single_file_url,token=HF_TOKEN).to(torch.device("cuda"),torch.bfloat16)
|
46 |
|
47 |
@spaces.GPU(duration=80)
|
48 |
def generate_video(
|
@@ -58,7 +51,7 @@ def generate_video(
|
|
58 |
progress=gr.Progress(track_tqdm=True)
|
59 |
):
|
60 |
pipe.text_encoder=text_encoder
|
61 |
-
|
62 |
seed=random.randint(0, MAX_SEED)
|
63 |
generator = torch.Generator(device="cuda").manual_seed(seed)
|
64 |
image = Image.open(image_url).convert("RGB")
|
|
|
26 |
MAX_SEED = np.iinfo(np.int64).max
|
27 |
|
28 |
single_file_url = "https://huggingface.co/Lightricks/LTX-Video/ltx-video-2b-v0.9.1.safetensors"
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
pipe = LTXImageToVideoPipeline.from_pretrained(
|
31 |
+
"Lightricks/LTX-Video",
|
|
|
32 |
token=HF_TOKEN,
|
33 |
+
transformer=None,
|
34 |
text_encoder=None,
|
35 |
).to(torch.device("cuda"),torch.bfloat16)
|
36 |
|
37 |
+
text_encoder = T5EncoderModel.from_pretrained("Lightricks/LTX-Video",subfolder='text_encoder',token=True).to(torch.device("cuda"),torch.bfloat16)
|
38 |
+
transformer = LTXVideoTransformer3DModel.from_single_file(single_file_url,token=HF_TOKEN).to(torch.device("cuda"),torch.bfloat16)
|
|
|
39 |
|
40 |
@spaces.GPU(duration=80)
|
41 |
def generate_video(
|
|
|
51 |
progress=gr.Progress(track_tqdm=True)
|
52 |
):
|
53 |
pipe.text_encoder=text_encoder
|
54 |
+
pipe.transformer=transformer
|
55 |
seed=random.randint(0, MAX_SEED)
|
56 |
generator = torch.Generator(device="cuda").manual_seed(seed)
|
57 |
image = Image.open(image_url).convert("RGB")
|