Spaces:
Runtime error
Runtime error
Merge branch 'main' of https://huggingface.co/spaces/PAIR/Text2Video-Zero into main
Browse files
model.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from enum import Enum
|
| 2 |
import gc
|
| 3 |
import numpy as np
|
| 4 |
-
import tomesd
|
| 5 |
import torch
|
| 6 |
|
| 7 |
from diffusers import StableDiffusionInstructPix2PixPipeline, StableDiffusionControlNetPipeline, ControlNetModel, UNet2DConditionModel, TextToVideoZeroPipeline
|
|
@@ -83,15 +83,16 @@ class Model:
|
|
| 83 |
generator=self.generator,
|
| 84 |
**kwargs)
|
| 85 |
|
| 86 |
-
def inference(self, split_to_chunks=False, chunk_size=
|
| 87 |
if not hasattr(self, "pipe") or self.pipe is None:
|
| 88 |
return
|
| 89 |
-
|
| 90 |
if "merging_ratio" in kwargs:
|
| 91 |
merging_ratio = kwargs.pop("merging_ratio")
|
| 92 |
|
| 93 |
# if merging_ratio > 0:
|
| 94 |
tomesd.apply_patch(self.pipe, ratio=merging_ratio)
|
|
|
|
| 95 |
seed = kwargs.pop('seed', 0)
|
| 96 |
if seed < 0:
|
| 97 |
seed = self.generator.seed()
|
|
@@ -134,7 +135,7 @@ class Model:
|
|
| 134 |
def process_controlnet_canny(self,
|
| 135 |
video_path,
|
| 136 |
prompt,
|
| 137 |
-
chunk_size=
|
| 138 |
watermark='Picsart AI Research',
|
| 139 |
merging_ratio=0.0,
|
| 140 |
num_inference_steps=20,
|
|
@@ -200,7 +201,7 @@ class Model:
|
|
| 200 |
def process_controlnet_depth(self,
|
| 201 |
video_path,
|
| 202 |
prompt,
|
| 203 |
-
chunk_size=
|
| 204 |
watermark='Picsart AI Research',
|
| 205 |
merging_ratio=0.0,
|
| 206 |
num_inference_steps=20,
|
|
@@ -263,7 +264,7 @@ class Model:
|
|
| 263 |
def process_controlnet_pose(self,
|
| 264 |
video_path,
|
| 265 |
prompt,
|
| 266 |
-
chunk_size=
|
| 267 |
watermark='Picsart AI Research',
|
| 268 |
merging_ratio=0.0,
|
| 269 |
num_inference_steps=20,
|
|
@@ -326,7 +327,7 @@ class Model:
|
|
| 326 |
db_path,
|
| 327 |
video_path,
|
| 328 |
prompt,
|
| 329 |
-
chunk_size=
|
| 330 |
watermark='Picsart AI Research',
|
| 331 |
merging_ratio=0.0,
|
| 332 |
num_inference_steps=20,
|
|
@@ -397,7 +398,7 @@ class Model:
|
|
| 397 |
start_t=0,
|
| 398 |
end_t=-1,
|
| 399 |
out_fps=-1,
|
| 400 |
-
chunk_size=
|
| 401 |
watermark='Picsart AI Research',
|
| 402 |
merging_ratio=0.0,
|
| 403 |
use_cf_attn=True,
|
|
@@ -434,7 +435,7 @@ class Model:
|
|
| 434 |
t0=44,
|
| 435 |
t1=47,
|
| 436 |
n_prompt="",
|
| 437 |
-
chunk_size=
|
| 438 |
video_length=8,
|
| 439 |
watermark='Picsart AI Research',
|
| 440 |
merging_ratio=0.0,
|
|
|
|
| 1 |
from enum import Enum
|
| 2 |
import gc
|
| 3 |
import numpy as np
|
| 4 |
+
#import tomesd
|
| 5 |
import torch
|
| 6 |
|
| 7 |
from diffusers import StableDiffusionInstructPix2PixPipeline, StableDiffusionControlNetPipeline, ControlNetModel, UNet2DConditionModel, TextToVideoZeroPipeline
|
|
|
|
| 83 |
generator=self.generator,
|
| 84 |
**kwargs)
|
| 85 |
|
| 86 |
+
def inference(self, split_to_chunks=False, chunk_size=2, **kwargs):
|
| 87 |
if not hasattr(self, "pipe") or self.pipe is None:
|
| 88 |
return
|
| 89 |
+
'''
|
| 90 |
if "merging_ratio" in kwargs:
|
| 91 |
merging_ratio = kwargs.pop("merging_ratio")
|
| 92 |
|
| 93 |
# if merging_ratio > 0:
|
| 94 |
tomesd.apply_patch(self.pipe, ratio=merging_ratio)
|
| 95 |
+
'''
|
| 96 |
seed = kwargs.pop('seed', 0)
|
| 97 |
if seed < 0:
|
| 98 |
seed = self.generator.seed()
|
|
|
|
| 135 |
def process_controlnet_canny(self,
|
| 136 |
video_path,
|
| 137 |
prompt,
|
| 138 |
+
chunk_size=2,
|
| 139 |
watermark='Picsart AI Research',
|
| 140 |
merging_ratio=0.0,
|
| 141 |
num_inference_steps=20,
|
|
|
|
| 201 |
def process_controlnet_depth(self,
|
| 202 |
video_path,
|
| 203 |
prompt,
|
| 204 |
+
chunk_size=2,
|
| 205 |
watermark='Picsart AI Research',
|
| 206 |
merging_ratio=0.0,
|
| 207 |
num_inference_steps=20,
|
|
|
|
| 264 |
def process_controlnet_pose(self,
|
| 265 |
video_path,
|
| 266 |
prompt,
|
| 267 |
+
chunk_size=2,
|
| 268 |
watermark='Picsart AI Research',
|
| 269 |
merging_ratio=0.0,
|
| 270 |
num_inference_steps=20,
|
|
|
|
| 327 |
db_path,
|
| 328 |
video_path,
|
| 329 |
prompt,
|
| 330 |
+
chunk_size=2,
|
| 331 |
watermark='Picsart AI Research',
|
| 332 |
merging_ratio=0.0,
|
| 333 |
num_inference_steps=20,
|
|
|
|
| 398 |
start_t=0,
|
| 399 |
end_t=-1,
|
| 400 |
out_fps=-1,
|
| 401 |
+
chunk_size=2,
|
| 402 |
watermark='Picsart AI Research',
|
| 403 |
merging_ratio=0.0,
|
| 404 |
use_cf_attn=True,
|
|
|
|
| 435 |
t0=44,
|
| 436 |
t1=47,
|
| 437 |
n_prompt="",
|
| 438 |
+
chunk_size=2,
|
| 439 |
video_length=8,
|
| 440 |
watermark='Picsart AI Research',
|
| 441 |
merging_ratio=0.0,
|