-
Notifications
You must be signed in to change notification settings - Fork 443
Expand file tree
/
Copy pathbasic_helios_distilled_t2v.py
More file actions
85 lines (75 loc) · 2.53 KB
/
Copy pathbasic_helios_distilled_t2v.py
File metadata and controls
85 lines (75 loc) · 2.53 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# SPDX-License-Identifier: Apache-2.0
"""Generate one Helios-Distilled T2V chunk through FastVideo's typed API.
Set ``HELIOS_MODEL_PATH`` to a local snapshot to avoid downloading the public
checkpoint again. The 33-frame example is a short integration run; increase
``num_frames`` to 240 for the official eight-chunk default.
"""
from __future__ import annotations
import os
from fastvideo import VideoGenerator
from fastvideo.api import (
EngineConfig,
GenerationRequest,
GeneratorConfig,
OffloadConfig,
OutputConfig,
SamplingConfig,
)
MODEL_PATH = os.getenv("HELIOS_MODEL_PATH", "BestWishYsh/Helios-Distilled")
OUTPUT_PATH = os.getenv(
"HELIOS_OUTPUT_PATH",
"outputs_video/helios/helios_distilled_t2v.mp4",
)
PROMPT = ("A vibrant tropical fish swims gracefully through a colorful coral reef "
"in clear turquoise water, cinematic close-up, fluid motion, vivid detail.")
NEGATIVE_PROMPT = ("Bright tones, overexposed, static, blurred details, subtitles, paintings, "
"images, overall gray, worst quality, low quality, JPEG artifacts, ugly, "
"deformed, disfigured, still picture, messy background.")
def main() -> None:
generator = VideoGenerator.from_config(
GeneratorConfig(
model_path=MODEL_PATH,
engine=EngineConfig(
num_gpus=1,
use_fsdp_inference=False,
offload=OffloadConfig(
dit=False,
dit_layerwise=True,
text_encoder=True,
vae=True,
pin_cpu_memory=False,
),
),
))
request = GenerationRequest(
prompt=PROMPT,
negative_prompt=NEGATIVE_PROMPT,
sampling=SamplingConfig(
seed=42,
height=384,
width=640,
num_frames=33,
fps=24,
num_inference_steps=2,
guidance_scale=1.0,
pyramid_num_inference_steps_list=[2, 2, 2],
history_sizes=[16, 2, 1],
num_latent_frames_per_chunk=9,
keep_first_frame=True,
is_skip_first_chunk=False,
use_zero_init=True,
zero_steps=1,
is_amplify_first_chunk=True,
),
output=OutputConfig(
output_path=OUTPUT_PATH,
save_video=True,
return_frames=False,
),
)
try:
generator.generate(request=request)
finally:
generator.shutdown()
if __name__ == "__main__":
main()