Anonymous commited on
Commit
a2ce0ab
1 Parent(s): ec310aa

delate 512

Browse files
Files changed (1) hide show
  1. app.py +45 -44
app.py CHANGED
@@ -21,28 +21,28 @@ def infer(prompt, output_size, seed, num_frames, ddim_steps, unconditional_guida
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_v1"
28
- ckpt_path_512 = "checkpoints/base_512_v1/model_512.ckpt"
29
- config_512 = "configs/inference_t2v_tconv512_v1.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="MoonQiu/LongerCrafter", filename="model_512.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="MoonQiu/LongerCrafter", filename="model_512.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 = 8
45
- elif output_size == "576x1024":
46
  width = 1024
47
  height = 576
48
  ckpt_dir_1024 = "checkpoints/base_1024_v1"
@@ -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
- # 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_256.pth"
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="MoonQiu/LongerCrafter", filename="model_256.pth", 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="MoonQiu/LongerCrafter", filename="model_256.pth", 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,7 +286,8 @@ 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
- output_size = gr.Dropdown(["320x512", "576x1024"], 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,
 
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_v1"
28
+ # ckpt_path_512 = "checkpoints/base_512_v1/model_512.ckpt"
29
+ # config_512 = "configs/inference_t2v_tconv512_v1.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="MoonQiu/LongerCrafter", filename="model_512.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="MoonQiu/LongerCrafter", filename="model_512.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 = 8
45
+ if output_size == "576x1024":
46
  width = 1024
47
  height = 576
48
  ckpt_dir_1024 = "checkpoints/base_1024_v1"
 
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_256.pth"
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="MoonQiu/LongerCrafter", filename="model_256.pth", 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="MoonQiu/LongerCrafter", filename="model_256.pth", 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"], 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
+ 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
  with gr.Row():
292
  num_frames = gr.Slider(label='Frames (a multiple of 4), max 36 for 1024 model',
293
  minimum=16,