multimodalart HF staff commited on
Commit
c166f1f
1 Parent(s): c3093f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -11
app.py CHANGED
@@ -42,15 +42,6 @@ snapshot_download(repo_id="AlexWortega/RIFE", local_dir="model_rife")
42
 
43
  pipe = CogVideoXPipeline.from_pretrained("THUDM/CogVideoX-5b", torch_dtype=torch.bfloat16).to("cpu")
44
  pipe.scheduler = CogVideoXDPMScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")
45
- pipe_video = CogVideoXVideoToVideoPipeline.from_pretrained(
46
- "THUDM/CogVideoX-5b",
47
- transformer=pipe.transformer,
48
- vae=pipe.vae,
49
- scheduler=pipe.scheduler,
50
- tokenizer=pipe.tokenizer,
51
- text_encoder=pipe.text_encoder,
52
- torch_dtype=torch.bfloat16,
53
- ).to("cpu")
54
 
55
  pipe_image = CogVideoXImageToVideoPipeline.from_pretrained(
56
  "THUDM/CogVideoX-5b-I2V",
@@ -229,7 +220,15 @@ def infer(
229
 
230
  if video_input is not None:
231
  video = load_video(video_input)[:49] # Limit to 49 frames
232
- pipe_video.to(device)
 
 
 
 
 
 
 
 
233
  video_pt = pipe_video(
234
  video=video,
235
  prompt=prompt,
@@ -241,7 +240,6 @@ def infer(
241
  guidance_scale=guidance_scale,
242
  generator=torch.Generator(device="cpu").manual_seed(seed),
243
  ).frames
244
- pipe_video.to("cpu")
245
  elif image_input is not None:
246
  pipe_image.to(device)
247
  image_input = Image.fromarray(image_input).resize(size=(720, 480)) # Convert to PIL
 
42
 
43
  pipe = CogVideoXPipeline.from_pretrained("THUDM/CogVideoX-5b", torch_dtype=torch.bfloat16).to("cpu")
44
  pipe.scheduler = CogVideoXDPMScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")
 
 
 
 
 
 
 
 
 
45
 
46
  pipe_image = CogVideoXImageToVideoPipeline.from_pretrained(
47
  "THUDM/CogVideoX-5b-I2V",
 
220
 
221
  if video_input is not None:
222
  video = load_video(video_input)[:49] # Limit to 49 frames
223
+ pipe_video = CogVideoXVideoToVideoPipeline.from_pretrained(
224
+ "THUDM/CogVideoX-5b",
225
+ transformer=pipe.transformer,
226
+ vae=pipe.vae,
227
+ scheduler=pipe.scheduler,
228
+ tokenizer=pipe.tokenizer,
229
+ text_encoder=pipe.text_encoder,
230
+ torch_dtype=torch.bfloat16,
231
+ ).to(device)
232
  video_pt = pipe_video(
233
  video=video,
234
  prompt=prompt,
 
240
  guidance_scale=guidance_scale,
241
  generator=torch.Generator(device="cpu").manual_seed(seed),
242
  ).frames
 
243
  elif image_input is not None:
244
  pipe_image.to(device)
245
  image_input = Image.fromarray(image_input).resize(size=(720, 480)) # Convert to PIL