Spaces:
Sleeping
Sleeping
Anonymous
commited on
Commit
·
186fae0
1
Parent(s):
a6fdb4d
add 512
Browse files
app.py
CHANGED
|
@@ -17,22 +17,39 @@ from funcs import (
|
|
| 17 |
)
|
| 18 |
from utils.utils import instantiate_from_config
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
os.makedirs(
|
| 23 |
-
hf_hub_download(repo_id="
|
| 24 |
|
| 25 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
# ckpt_dir_256 = "checkpoints/base_256_v1"
|
| 27 |
# os.makedirs(ckpt_dir_256, exist_ok=True)
|
| 28 |
-
# hf_hub_download(repo_id="MoonQiu/LongerCrafter", filename="
|
| 29 |
|
| 30 |
|
| 31 |
def infer(prompt, output_size, seed, num_frames, ddim_steps, unconditional_guidance_scale, save_fps):
|
| 32 |
window_size = 16
|
| 33 |
window_stride = 4
|
| 34 |
|
| 35 |
-
if output_size == "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
width = 1024
|
| 37 |
height = 576
|
| 38 |
config_1024 = "configs/inference_t2v_1024_v1.0_freenoise.yaml"
|
|
@@ -253,8 +270,8 @@ with gr.Blocks(css=css) as demo:
|
|
| 253 |
with gr.Row():
|
| 254 |
with gr.Accordion('FreeNoise Parameters (feel free to adjust these parameters based on your prompt): ', open=False):
|
| 255 |
with gr.Row():
|
| 256 |
-
output_size = gr.Dropdown(["576x1024"], value="576x1024", label="Output Size (around 900s for 576x1024)")
|
| 257 |
-
|
| 258 |
with gr.Row():
|
| 259 |
num_frames = gr.Slider(label='Frames (a multiple of 4)',
|
| 260 |
minimum=16,
|
|
|
|
| 17 |
)
|
| 18 |
from utils.utils import instantiate_from_config
|
| 19 |
|
| 20 |
+
ckpt_path_512 = "checkpoints/base_512_v1/model_512.ckpt"
|
| 21 |
+
ckpt_dir_512 = "checkpoints/base_512_v1"
|
| 22 |
+
os.makedirs(ckpt_dir_512, exist_ok=True)
|
| 23 |
+
hf_hub_download(repo_id="MoonQiu/LongerCrafter", filename="model_512.ckpt", local_dir=ckpt_dir_512)
|
| 24 |
|
| 25 |
+
# ckpt_path_1024 = "checkpoints/base_1024_v1/model.ckpt"
|
| 26 |
+
# ckpt_dir_1024 = "checkpoints/base_1024_v1"
|
| 27 |
+
# os.makedirs(ckpt_dir_1024, exist_ok=True)
|
| 28 |
+
# hf_hub_download(repo_id="VideoCrafter/Text2Video-1024", filename="model.ckpt", local_dir=ckpt_dir_1024)
|
| 29 |
+
|
| 30 |
+
# ckpt_path_256 = "checkpoints/base_256_v1/model_256.pth"
|
| 31 |
# ckpt_dir_256 = "checkpoints/base_256_v1"
|
| 32 |
# os.makedirs(ckpt_dir_256, exist_ok=True)
|
| 33 |
+
# hf_hub_download(repo_id="MoonQiu/LongerCrafter", filename="model_256.pth", local_dir=ckpt_dir_256)
|
| 34 |
|
| 35 |
|
| 36 |
def infer(prompt, output_size, seed, num_frames, ddim_steps, unconditional_guidance_scale, save_fps):
|
| 37 |
window_size = 16
|
| 38 |
window_stride = 4
|
| 39 |
|
| 40 |
+
if output_size == "320x512":
|
| 41 |
+
width = 512
|
| 42 |
+
height = 320
|
| 43 |
+
config_512 = "configs/inference_t2v_tconv512_v1.0_freenoise.yaml"
|
| 44 |
+
config_512 = OmegaConf.load(config_512)
|
| 45 |
+
model_config_512 = config_512.pop("model", OmegaConf.create())
|
| 46 |
+
model_512 = instantiate_from_config(model_config_512)
|
| 47 |
+
model_512 = model_512.cuda()
|
| 48 |
+
model_512 = load_model_checkpoint(model_512, ckpt_path_512)
|
| 49 |
+
model_512.eval()
|
| 50 |
+
model = model_512
|
| 51 |
+
fps = 8
|
| 52 |
+
elif output_size == "576x1024":
|
| 53 |
width = 1024
|
| 54 |
height = 576
|
| 55 |
config_1024 = "configs/inference_t2v_1024_v1.0_freenoise.yaml"
|
|
|
|
| 270 |
with gr.Row():
|
| 271 |
with gr.Accordion('FreeNoise Parameters (feel free to adjust these parameters based on your prompt): ', open=False):
|
| 272 |
with gr.Row():
|
| 273 |
+
# output_size = gr.Dropdown(["576x1024"], value="576x1024", label="Output Size (around 900s for 576x1024)")
|
| 274 |
+
output_size = gr.Dropdown(["320x512", "576x1024"], value="320x512", label="Output Size", info="576x1024 will cost around 900s")
|
| 275 |
with gr.Row():
|
| 276 |
num_frames = gr.Slider(label='Frames (a multiple of 4)',
|
| 277 |
minimum=16,
|
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_256.pth'
|
| 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,6 +1,6 @@
|
|
| 1 |
name="base_512_test"
|
| 2 |
|
| 3 |
-
ckpt='checkpoints/base_512_v1/
|
| 4 |
config='configs/inference_t2v_tconv512_v1.0_freenoise.yaml'
|
| 5 |
|
| 6 |
prompt_file="prompts/single_prompts.txt"
|
|
|
|
| 1 |
name="base_512_test"
|
| 2 |
|
| 3 |
+
ckpt='checkpoints/base_512_v1/model_512.ckpt'
|
| 4 |
config='configs/inference_t2v_tconv512_v1.0_freenoise.yaml'
|
| 5 |
|
| 6 |
prompt_file="prompts/single_prompts.txt"
|
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_256.pth'
|
| 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,6 +1,6 @@
|
|
| 1 |
name="base_512_test"
|
| 2 |
|
| 3 |
-
ckpt='checkpoints/base_512_v1/
|
| 4 |
config='configs/inference_t2v_tconv512_v1.0_freenoise.yaml'
|
| 5 |
|
| 6 |
prompt_file="prompts/mp_prompts.txt"
|
|
|
|
| 1 |
name="base_512_test"
|
| 2 |
|
| 3 |
+
ckpt='checkpoints/base_512_v1/model_512.ckpt'
|
| 4 |
config='configs/inference_t2v_tconv512_v1.0_freenoise.yaml'
|
| 5 |
|
| 6 |
prompt_file="prompts/mp_prompts.txt"
|