Spaces:
Runtime error
Runtime error
Update DF.py
Browse files
DF.py
CHANGED
|
@@ -18,7 +18,7 @@ def generate_video(prompt, negative_prompt, width, height, num_frames,
|
|
| 18 |
start_time = time.time()
|
| 19 |
torch.cuda.empty_cache()
|
| 20 |
|
| 21 |
-
# Load
|
| 22 |
vae = AutoencoderKLWan.from_pretrained(
|
| 23 |
"Wan-AI/Wan2.2-T2V-A14B-Diffusers",
|
| 24 |
subfolder="vae",
|
|
@@ -31,15 +31,9 @@ def generate_video(prompt, negative_prompt, width, height, num_frames,
|
|
| 31 |
torch_dtype=torch.bfloat16,
|
| 32 |
)
|
| 33 |
|
| 34 |
-
#
|
| 35 |
DFloat11Model.from_pretrained(
|
| 36 |
-
"
|
| 37 |
-
device="cpu",
|
| 38 |
-
cpu_offload=cpu_offload,
|
| 39 |
-
bfloat16_model=pipe.transformer,
|
| 40 |
-
)
|
| 41 |
-
DFloat11Model.from_pretrained(
|
| 42 |
-
"LeanModels/Wan2.2-T2V-A14B-2-DF11",
|
| 43 |
device="cpu",
|
| 44 |
cpu_offload=cpu_offload,
|
| 45 |
bfloat16_model=pipe.transformer_2,
|
|
@@ -70,7 +64,7 @@ def generate_video(prompt, negative_prompt, width, height, num_frames,
|
|
| 70 |
|
| 71 |
# Gradio UI
|
| 72 |
with gr.Blocks() as demo:
|
| 73 |
-
gr.Markdown("## 🎬 Wan2.2 + DFloat11 - Text to Video Generator")
|
| 74 |
|
| 75 |
with gr.Row():
|
| 76 |
prompt = gr.Textbox(label="Prompt", value="A serene koi pond at night, with glowing lanterns reflecting on the rippling water. Ethereal fireflies dance above as cherry blossoms gently fall.", lines=3)
|
|
|
|
| 18 |
start_time = time.time()
|
| 19 |
torch.cuda.empty_cache()
|
| 20 |
|
| 21 |
+
# Load VAE and Wan2.2 pipeline
|
| 22 |
vae = AutoencoderKLWan.from_pretrained(
|
| 23 |
"Wan-AI/Wan2.2-T2V-A14B-Diffusers",
|
| 24 |
subfolder="vae",
|
|
|
|
| 31 |
torch_dtype=torch.bfloat16,
|
| 32 |
)
|
| 33 |
|
| 34 |
+
# Only apply second-stage DFloat11 model
|
| 35 |
DFloat11Model.from_pretrained(
|
| 36 |
+
"DFloat11/Wan2.2-T2V-A14B-2-DF11",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
device="cpu",
|
| 38 |
cpu_offload=cpu_offload,
|
| 39 |
bfloat16_model=pipe.transformer_2,
|
|
|
|
| 64 |
|
| 65 |
# Gradio UI
|
| 66 |
with gr.Blocks() as demo:
|
| 67 |
+
gr.Markdown("## 🎬 Wan2.2 + DFloat11 (Stage 2 only) - Text to Video Generator")
|
| 68 |
|
| 69 |
with gr.Row():
|
| 70 |
prompt = gr.Textbox(label="Prompt", value="A serene koi pond at night, with glowing lanterns reflecting on the rippling water. Ethereal fireflies dance above as cherry blossoms gently fall.", lines=3)
|