fffiloni commited on
Commit
dfaa5fc
1 Parent(s): 8f29bd8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -27,7 +27,7 @@ hf_hub_download(
27
  )
28
 
29
  model_id = "THUDM/CogVideoX-5b-I2V"
30
-
31
  text_encoder = T5EncoderModel.from_pretrained(model_id, subfolder="text_encoder", torch_dtype=torch.float16)
32
  vae = AutoencoderKLCogVideoX.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float16)
33
  tokenizer = T5Tokenizer.from_pretrained(model_id, subfolder="tokenizer")
@@ -73,7 +73,7 @@ def clear_gpu():
73
 
74
 
75
  def infer(image_path, prompt, orbit_type, progress=gr.Progress(track_tqdm=True)):
76
- transformer = CogVideoXTransformer3DModel.from_pretrained(model_id, subfolder="transformer", torch_dtype=torch.float16)
77
  pipe = CogVideoXImageToVideoPipeline.from_pretrained(model_id, tokenizer=tokenizer, text_encoder=text_encoder, transformer=transformer, vae=vae, torch_dtype=torch.float16)
78
  lora_path = "checkpoints/"
79
  adapter_name = None
@@ -105,6 +105,7 @@ def infer(image_path, prompt, orbit_type, progress=gr.Progress(track_tqdm=True))
105
  )
106
 
107
  find_and_move_object_to_cpu()
 
108
  clear_gpu()
109
 
110
  # Generate a timestamp for the output filename
 
27
  )
28
 
29
  model_id = "THUDM/CogVideoX-5b-I2V"
30
+ transformer = CogVideoXTransformer3DModel.from_pretrained(model_id, subfolder="transformer", torch_dtype=torch.float16)
31
  text_encoder = T5EncoderModel.from_pretrained(model_id, subfolder="text_encoder", torch_dtype=torch.float16)
32
  vae = AutoencoderKLCogVideoX.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float16)
33
  tokenizer = T5Tokenizer.from_pretrained(model_id, subfolder="tokenizer")
 
73
 
74
 
75
  def infer(image_path, prompt, orbit_type, progress=gr.Progress(track_tqdm=True)):
76
+
77
  pipe = CogVideoXImageToVideoPipeline.from_pretrained(model_id, tokenizer=tokenizer, text_encoder=text_encoder, transformer=transformer, vae=vae, torch_dtype=torch.float16)
78
  lora_path = "checkpoints/"
79
  adapter_name = None
 
105
  )
106
 
107
  find_and_move_object_to_cpu()
108
+ pipe.to("cpu")
109
  clear_gpu()
110
 
111
  # Generate a timestamp for the output filename