Let's follow the advice of the error message: add low_cpu_mem_usage=False and device_map=None
#32
by
Fabrice-TIERCELIN
- opened
app.py
CHANGED
|
@@ -23,6 +23,11 @@ fps14Pipe = StableVideoDiffusionPipeline.from_pretrained(
|
|
| 23 |
)
|
| 24 |
fps14Pipe.to("cuda")
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
max_64_bit_int = 2**63 - 1
|
| 27 |
|
| 28 |
def animate(
|
|
@@ -101,7 +106,9 @@ def animate_on_gpu(
|
|
| 101 |
):
|
| 102 |
generator = torch.manual_seed(seed)
|
| 103 |
|
| 104 |
-
if version == "
|
|
|
|
|
|
|
| 105 |
return fps25Pipe(image, decode_chunk_size=decoding_t, generator=generator, motion_bucket_id=motion_bucket_id, noise_aug_strength=noise_aug_strength, num_frames=25).frames[0]
|
| 106 |
else:
|
| 107 |
return fps14Pipe(image, decode_chunk_size=decoding_t, generator=generator, motion_bucket_id=motion_bucket_id, noise_aug_strength=noise_aug_strength, num_frames=25).frames[0]
|
|
@@ -172,13 +179,13 @@ with gr.Blocks() as demo:
|
|
| 172 |
with gr.Column():
|
| 173 |
image = gr.Image(label="Upload your image", type="pil")
|
| 174 |
with gr.Accordion("Advanced options", open=False):
|
| 175 |
-
fps_id = gr.Slider(label="Frames per second", info="The length of your video in seconds will be 25/fps", value=
|
| 176 |
motion_bucket_id = gr.Slider(label="Motion bucket id", info="Controls how much motion to add/remove from the image", value=127, minimum=1, maximum=255)
|
| 177 |
noise_aug_strength = gr.Slider(label="Noise strength", info="The noise to add", value=0.1, minimum=0, maximum=1, step=0.1)
|
| 178 |
decoding_t = gr.Slider(label="Decoding", info="Number of frames decoded at a time; this eats more VRAM; reduce if necessary", value=3, minimum=1, maximum=5, step=1)
|
| 179 |
video_format = gr.Radio([["*.mp4", "mp4"], ["*.gif", "gif"]], label="Video format for result", info="File extention", value="mp4", interactive=True)
|
| 180 |
frame_format = gr.Radio([["*.webp", "webp"], ["*.png", "png"], ["*.jpeg", "jpeg"], ["*.gif (unanimated)", "gif"], ["*.bmp", "bmp"]], label="Image format for frames", info="File extention", value="webp", interactive=True)
|
| 181 |
-
version = gr.Radio([["Auto", "auto"], ["ππ»ββοΈ SVD (trained on 14 f/s)", "svd"], ["ππ»ββοΈπ¨ SVD-XT (trained on 25 f/s)", "svdxt"]], label="Model", info="Trained model", value="auto", interactive=True)
|
| 182 |
seed = gr.Slider(label="Seed", value=42, randomize=True, minimum=0, maximum=max_64_bit_int, step=1)
|
| 183 |
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
| 184 |
|
|
|
|
| 23 |
)
|
| 24 |
fps14Pipe.to("cuda")
|
| 25 |
|
| 26 |
+
dragnuwaPipe = StableVideoDiffusionPipeline.from_pretrained(
|
| 27 |
+
"a-r-r-o-w/dragnuwa-svd", torch_dtype=torch.float16, variant="fp16", low_cpu_mem_usage=False, device_map=None
|
| 28 |
+
)
|
| 29 |
+
dragnuwaPipe.to("cuda")
|
| 30 |
+
|
| 31 |
max_64_bit_int = 2**63 - 1
|
| 32 |
|
| 33 |
def animate(
|
|
|
|
| 106 |
):
|
| 107 |
generator = torch.manual_seed(seed)
|
| 108 |
|
| 109 |
+
if version == "dragnuwa":
|
| 110 |
+
return dragnuwaPipe(image, decode_chunk_size=decoding_t, generator=generator, motion_bucket_id=motion_bucket_id, noise_aug_strength=noise_aug_strength, num_frames=25).frames[0]
|
| 111 |
+
elif version == "svdxt":
|
| 112 |
return fps25Pipe(image, decode_chunk_size=decoding_t, generator=generator, motion_bucket_id=motion_bucket_id, noise_aug_strength=noise_aug_strength, num_frames=25).frames[0]
|
| 113 |
else:
|
| 114 |
return fps14Pipe(image, decode_chunk_size=decoding_t, generator=generator, motion_bucket_id=motion_bucket_id, noise_aug_strength=noise_aug_strength, num_frames=25).frames[0]
|
|
|
|
| 179 |
with gr.Column():
|
| 180 |
image = gr.Image(label="Upload your image", type="pil")
|
| 181 |
with gr.Accordion("Advanced options", open=False):
|
| 182 |
+
fps_id = gr.Slider(label="Frames per second", info="The length of your video in seconds will be 25/fps", value=25, minimum=5, maximum=30)
|
| 183 |
motion_bucket_id = gr.Slider(label="Motion bucket id", info="Controls how much motion to add/remove from the image", value=127, minimum=1, maximum=255)
|
| 184 |
noise_aug_strength = gr.Slider(label="Noise strength", info="The noise to add", value=0.1, minimum=0, maximum=1, step=0.1)
|
| 185 |
decoding_t = gr.Slider(label="Decoding", info="Number of frames decoded at a time; this eats more VRAM; reduce if necessary", value=3, minimum=1, maximum=5, step=1)
|
| 186 |
video_format = gr.Radio([["*.mp4", "mp4"], ["*.gif", "gif"]], label="Video format for result", info="File extention", value="mp4", interactive=True)
|
| 187 |
frame_format = gr.Radio([["*.webp", "webp"], ["*.png", "png"], ["*.jpeg", "jpeg"], ["*.gif (unanimated)", "gif"], ["*.bmp", "bmp"]], label="Image format for frames", info="File extention", value="webp", interactive=True)
|
| 188 |
+
version = gr.Radio([["Auto", "auto"], ["ππ»ββοΈ SVD (trained on 14 f/s)", "svd"], ["ππ»ββοΈπ¨ SVD-XT (trained on 25 f/s)", "svdxt"], ["DragNUWA", "dragnuwa"]], label="Model", info="Trained model", value="auto", interactive=True)
|
| 189 |
seed = gr.Slider(label="Seed", value=42, randomize=True, minimum=0, maximum=max_64_bit_int, step=1)
|
| 190 |
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
| 191 |
|