Spaces:
Running
Running
OmPrakashSingh1704
commited on
Commit
·
ad69708
1
Parent(s):
ad2ab39
options/Video_model/Model.py
CHANGED
@@ -55,31 +55,28 @@ def Video(
|
|
55 |
|
56 |
# Perform computation with appropriate dtype based on device
|
57 |
if device == "cuda":
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
noise_aug_strength=0.02,
|
81 |
-
generator=generator,
|
82 |
-
).frames[0]
|
83 |
|
84 |
# Save the generated video
|
85 |
save_video(frames, video_path, fps=fps, quality=5.0)
|
|
|
55 |
|
56 |
# Perform computation with appropriate dtype based on device
|
57 |
if device == "cuda":
|
58 |
+
# Use float16 for GPU
|
59 |
+
with torch.autocast(device_type='cuda', dtype=torch.float16):
|
60 |
+
frames = pipeline(
|
61 |
+
image, height=height, width=width,
|
62 |
+
num_inference_steps=num_inference_steps,
|
63 |
+
min_guidance_scale=min_guidance_scale,
|
64 |
+
max_guidance_scale=max_guidance_scale,
|
65 |
+
num_frames=num_frames, fps=fps, motion_bucket_id=motion_bucket_id,
|
66 |
+
generator=generator,
|
67 |
+
).frames[0]
|
68 |
+
else:
|
69 |
+
# Use bfloat16 for CPU as it's supported in torch.autocast
|
70 |
+
with torch.autocast(device_type='cpu', dtype=torch.bfloat16):
|
71 |
+
frames = pipeline(
|
72 |
+
image, height=height, width=width,
|
73 |
+
num_inference_steps=num_inference_steps,
|
74 |
+
min_guidance_scale=min_guidance_scale,
|
75 |
+
max_guidance_scale=max_guidance_scale,
|
76 |
+
num_frames=num_frames, fps=fps, motion_bucket_id=motion_bucket_id,
|
77 |
+
generator=generator,
|
78 |
+
).frames[0]
|
79 |
+
|
|
|
|
|
|
|
80 |
|
81 |
# Save the generated video
|
82 |
save_video(frames, video_path, fps=fps, quality=5.0)
|
options/Video_model/__pycache__/Model.cpython-310.pyc
CHANGED
Binary files a/options/Video_model/__pycache__/Model.cpython-310.pyc and b/options/Video_model/__pycache__/Model.cpython-310.pyc differ
|
|
options/__pycache__/Video.cpython-310.pyc
CHANGED
Binary files a/options/__pycache__/Video.cpython-310.pyc and b/options/__pycache__/Video.cpython-310.pyc differ
|
|