Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,12 +8,15 @@ pipe = CogVideoXImageToVideoPipeline.from_pretrained(
|
|
| 8 |
"THUDM/CogVideoX-5b-I2V",
|
| 9 |
torch_dtype=torch.bfloat16
|
| 10 |
)
|
| 11 |
-
|
| 12 |
-
pipe.vae.enable_tiling()
|
| 13 |
-
pipe.vae.enable_slicing()
|
| 14 |
|
| 15 |
@spaces.GPU(duration=120)
|
| 16 |
def generate_video(prompt, image):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
video = pipe(
|
| 18 |
prompt=prompt,
|
| 19 |
image=image,
|
|
@@ -21,7 +24,7 @@ def generate_video(prompt, image):
|
|
| 21 |
num_inference_steps=50,
|
| 22 |
num_frames=49,
|
| 23 |
guidance_scale=6,
|
| 24 |
-
generator=
|
| 25 |
).frames[0]
|
| 26 |
|
| 27 |
video_path = "output.mp4"
|
|
|
|
| 8 |
"THUDM/CogVideoX-5b-I2V",
|
| 9 |
torch_dtype=torch.bfloat16
|
| 10 |
)
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
@spaces.GPU(duration=120)
|
| 13 |
def generate_video(prompt, image):
|
| 14 |
+
# Ensure the generator is on the same device as the model
|
| 15 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 16 |
+
pipe.vae.enable_tiling()
|
| 17 |
+
pipe.vae.enable_slicing()
|
| 18 |
+
generator = torch.Generator(device=device).manual_seed(42)
|
| 19 |
+
|
| 20 |
video = pipe(
|
| 21 |
prompt=prompt,
|
| 22 |
image=image,
|
|
|
|
| 24 |
num_inference_steps=50,
|
| 25 |
num_frames=49,
|
| 26 |
guidance_scale=6,
|
| 27 |
+
generator=generator,
|
| 28 |
).frames[0]
|
| 29 |
|
| 30 |
video_path = "output.mp4"
|