Spaces:
Sleeping
Sleeping
Anonymous
commited on
Commit
β’
d592ac3
1
Parent(s):
bfa1f1d
update videocrafter2
Browse files- app.py +43 -45
- configs/{inference_t2v_tconv512_v1.0.yaml β inference_t2v_tconv512_v2.0.yaml} +0 -0
- configs/{inference_t2v_tconv512_v1.0_freenoise.yaml β inference_t2v_tconv512_v2.0_freenoise.yaml} +0 -0
- scripts/run_text2video_freenoise_256.sh +1 -1
- scripts/run_text2video_freenoise_512.sh +3 -3
- scripts/run_text2video_freenoise_mp_256.sh +1 -1
- scripts/run_text2video_freenoise_mp_512.sh +3 -3
app.py
CHANGED
@@ -21,27 +21,27 @@ def infer(prompt, output_size, seed, num_frames, ddim_steps, unconditional_guida
|
|
21 |
window_size = 16
|
22 |
window_stride = 4
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
if output_size == "576x1024":
|
46 |
width = 1024
|
47 |
height = 576
|
@@ -64,27 +64,27 @@ def infer(prompt, output_size, seed, num_frames, ddim_steps, unconditional_guida
|
|
64 |
model = model_1024
|
65 |
fps = 28
|
66 |
num_frames = min(num_frames, 36)
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
|
89 |
if seed is None:
|
90 |
seed = int.from_bytes(os.urandom(2), "big")
|
@@ -286,9 +286,7 @@ with gr.Blocks(css=css) as demo:
|
|
286 |
with gr.Row():
|
287 |
with gr.Accordion('FreeNoise Parameters (feel free to adjust these parameters based on your prompt): ', open=False):
|
288 |
with gr.Row():
|
289 |
-
|
290 |
-
# output_size = gr.Dropdown(["256x256", "576x1024"], value="576x1024", label="Output Size", info="900s for 1024 model (32 frames). Recovering from sleeping will take more time to download ckpt")
|
291 |
-
output_size = gr.Dropdown(["576x1024"], value="576x1024", label="Output Size", info="900s for 1024 model (32 frames). Recovering from sleeping will take more time to download ckpt")
|
292 |
with gr.Row():
|
293 |
num_frames = gr.Slider(label='Frames (a multiple of 4), max 36 for 1024 model',
|
294 |
minimum=16,
|
|
|
21 |
window_size = 16
|
22 |
window_stride = 4
|
23 |
|
24 |
+
if output_size == "320x512":
|
25 |
+
width = 512
|
26 |
+
height = 320
|
27 |
+
ckpt_dir_512 = "checkpoints/base_512_v2"
|
28 |
+
ckpt_path_512 = "checkpoints/base_512_v2/model.ckpt"
|
29 |
+
config_512 = "configs/inference_t2v_tconv512_v2.0_freenoise.yaml"
|
30 |
+
config_512 = OmegaConf.load(config_512)
|
31 |
+
model_config_512 = config_512.pop("model", OmegaConf.create())
|
32 |
+
model_512 = instantiate_from_config(model_config_512)
|
33 |
+
model_512 = model_512.cuda()
|
34 |
+
if not os.path.exists(ckpt_path_512):
|
35 |
+
os.makedirs(ckpt_dir_512, exist_ok=True)
|
36 |
+
hf_hub_download(repo_id="VideoCrafter/VideoCrafter2", filename="model.ckpt", local_dir=ckpt_dir_512)
|
37 |
+
try:
|
38 |
+
model_512 = load_model_checkpoint(model_512, ckpt_path_512)
|
39 |
+
except:
|
40 |
+
hf_hub_download(repo_id="VideoCrafter/VideoCrafter2", filename="model.ckpt", local_dir=ckpt_dir_512, force_download=True)
|
41 |
+
model_512 = load_model_checkpoint(model_512, ckpt_path_512)
|
42 |
+
model_512.eval()
|
43 |
+
model = model_512
|
44 |
+
fps = 16
|
45 |
if output_size == "576x1024":
|
46 |
width = 1024
|
47 |
height = 576
|
|
|
64 |
model = model_1024
|
65 |
fps = 28
|
66 |
num_frames = min(num_frames, 36)
|
67 |
+
elif output_size == "256x256":
|
68 |
+
width = 256
|
69 |
+
height = 256
|
70 |
+
ckpt_dir_256 = "checkpoints/base_256_v1"
|
71 |
+
ckpt_path_256 = "checkpoints/base_256_v1/model.ckpt"
|
72 |
+
config_256 = "configs/inference_t2v_tconv256_v1.0_freenoise.yaml"
|
73 |
+
config_256 = OmegaConf.load(config_256)
|
74 |
+
model_config_256 = config_256.pop("model", OmegaConf.create())
|
75 |
+
model_256 = instantiate_from_config(model_config_256)
|
76 |
+
model_256 = model_256.cuda()
|
77 |
+
if not os.path.exists(ckpt_path_256):
|
78 |
+
os.makedirs(ckpt_dir_256, exist_ok=True)
|
79 |
+
hf_hub_download(repo_id="VideoCrafter/Text2Video-256", filename="model.ckpt", local_dir=ckpt_dir_256)
|
80 |
+
try:
|
81 |
+
model_256 = load_model_checkpoint(model_256, ckpt_path_256)
|
82 |
+
except:
|
83 |
+
hf_hub_download(repo_id="VideoCrafter/Text2Video-256", filename="model.ckpt", local_dir=ckpt_dir_256, force_download=True)
|
84 |
+
model_256 = load_model_checkpoint(model_256, ckpt_path_256)
|
85 |
+
model_256.eval()
|
86 |
+
model = model_256
|
87 |
+
fps = 8
|
88 |
|
89 |
if seed is None:
|
90 |
seed = int.from_bytes(os.urandom(2), "big")
|
|
|
286 |
with gr.Row():
|
287 |
with gr.Accordion('FreeNoise Parameters (feel free to adjust these parameters based on your prompt): ', open=False):
|
288 |
with gr.Row():
|
289 |
+
output_size = gr.Dropdown(["320x512", "576x1024", "256x256"], value="320x512", label="Output Size", info="250s for 512 model, 900s for 1024 model (32 frames). Recovering from sleeping will take more time to download ckpt")
|
|
|
|
|
290 |
with gr.Row():
|
291 |
num_frames = gr.Slider(label='Frames (a multiple of 4), max 36 for 1024 model',
|
292 |
minimum=16,
|
configs/{inference_t2v_tconv512_v1.0.yaml β inference_t2v_tconv512_v2.0.yaml}
RENAMED
File without changes
|
configs/{inference_t2v_tconv512_v1.0_freenoise.yaml β inference_t2v_tconv512_v2.0_freenoise.yaml}
RENAMED
File without changes
|
scripts/run_text2video_freenoise_256.sh
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
name="base_256_test"
|
2 |
|
3 |
-
ckpt='checkpoints/base_256_v1/
|
4 |
config='configs/inference_t2v_tconv256_v1.0_freenoise.yaml'
|
5 |
|
6 |
prompt_file="prompts/single_prompts.txt"
|
|
|
1 |
name="base_256_test"
|
2 |
|
3 |
+
ckpt='checkpoints/base_256_v1/model.ckpt'
|
4 |
config='configs/inference_t2v_tconv256_v1.0_freenoise.yaml'
|
5 |
|
6 |
prompt_file="prompts/single_prompts.txt"
|
scripts/run_text2video_freenoise_512.sh
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
name="base_512_test"
|
2 |
|
3 |
-
ckpt='checkpoints/
|
4 |
-
config='configs/
|
5 |
|
6 |
prompt_file="prompts/single_prompts.txt"
|
7 |
res_dir="results_freenoise_single_512"
|
@@ -18,7 +18,7 @@ python3 scripts/evaluation/inference_freenoise.py \
|
|
18 |
--ddim_steps 50 \
|
19 |
--ddim_eta 0.0 \
|
20 |
--prompt_file $prompt_file \
|
21 |
-
--fps
|
22 |
--frames 64 \
|
23 |
--window_size 16 \
|
24 |
--window_stride 4
|
|
|
1 |
name="base_512_test"
|
2 |
|
3 |
+
ckpt='checkpoints/base_512_v2/model.ckpt'
|
4 |
+
config='configs/inference_t2v_tconv512_v2.0_freenoise.yaml'
|
5 |
|
6 |
prompt_file="prompts/single_prompts.txt"
|
7 |
res_dir="results_freenoise_single_512"
|
|
|
18 |
--ddim_steps 50 \
|
19 |
--ddim_eta 0.0 \
|
20 |
--prompt_file $prompt_file \
|
21 |
+
--fps 16 \
|
22 |
--frames 64 \
|
23 |
--window_size 16 \
|
24 |
--window_stride 4
|
scripts/run_text2video_freenoise_mp_256.sh
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
name="base_256_test"
|
2 |
|
3 |
-
ckpt='checkpoints/base_256_v1/
|
4 |
config='configs/inference_t2v_tconv256_v1.0_freenoise.yaml'
|
5 |
|
6 |
prompt_file="prompts/mp_prompts.txt"
|
|
|
1 |
name="base_256_test"
|
2 |
|
3 |
+
ckpt='checkpoints/base_256_v1/model.ckpt'
|
4 |
config='configs/inference_t2v_tconv256_v1.0_freenoise.yaml'
|
5 |
|
6 |
prompt_file="prompts/mp_prompts.txt"
|
scripts/run_text2video_freenoise_mp_512.sh
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
name="base_512_test"
|
2 |
|
3 |
-
ckpt='checkpoints/
|
4 |
-
config='configs/
|
5 |
|
6 |
prompt_file="prompts/mp_prompts.txt"
|
7 |
res_dir="results_freenoise_mp_512"
|
@@ -18,7 +18,7 @@ python3 scripts/evaluation/inference_freenoise_mp.py \
|
|
18 |
--ddim_steps 50 \
|
19 |
--ddim_eta 0.0 \
|
20 |
--prompt_file $prompt_file \
|
21 |
-
--fps
|
22 |
--frames 64 \
|
23 |
--window_size 16 \
|
24 |
--window_stride 4
|
|
|
1 |
name="base_512_test"
|
2 |
|
3 |
+
ckpt='checkpoints/base_512_v2/model.ckpt'
|
4 |
+
config='configs/inference_t2v_tconv512_v2.0_freenoise.yaml'
|
5 |
|
6 |
prompt_file="prompts/mp_prompts.txt"
|
7 |
res_dir="results_freenoise_mp_512"
|
|
|
18 |
--ddim_steps 50 \
|
19 |
--ddim_eta 0.0 \
|
20 |
--prompt_file $prompt_file \
|
21 |
+
--fps 16 \
|
22 |
--frames 64 \
|
23 |
--window_size 16 \
|
24 |
--window_stride 4
|