Spaces:
Running
on
Zero
Running
on
Zero
Update kandinsky/t2v_pipeline.py
Browse files
kandinsky/t2v_pipeline.py
CHANGED
@@ -111,9 +111,9 @@ class Kandinsky4T2VPipeline:
|
|
111 |
width: int = 512,
|
112 |
height: int = 512,
|
113 |
seed: int = None,
|
114 |
-
return_frames: bool =
|
115 |
):
|
116 |
-
num_steps =
|
117 |
|
118 |
# SEED
|
119 |
if seed is None:
|
@@ -135,7 +135,7 @@ class Kandinsky4T2VPipeline:
|
|
135 |
if (height, width) not in self.RESOLUTIONS[self.resolution]:
|
136 |
raise ValueError(f"Wrong height, width pair. Available (height, width) are: {self.RESOLUTIONS[self.resolution]}")
|
137 |
|
138 |
-
if num_steps !=
|
139 |
raise NotImplementedError(f"In the distilled version number of steps have to be strictly equal to 4")
|
140 |
|
141 |
# PREPARATION
|
@@ -198,4 +198,4 @@ class Kandinsky4T2VPipeline:
|
|
198 |
return_images.append(ToPILImage()(image))
|
199 |
return return_images
|
200 |
else:
|
201 |
-
torchvision.io.write_video(save_path, 255. * images.squeeze(0).float().permute(1, 2, 3, 0).cpu().numpy(), fps=
|
|
|
111 |
width: int = 512,
|
112 |
height: int = 512,
|
113 |
seed: int = None,
|
114 |
+
return_frames: bool = False
|
115 |
):
|
116 |
+
num_steps = 4
|
117 |
|
118 |
# SEED
|
119 |
if seed is None:
|
|
|
135 |
if (height, width) not in self.RESOLUTIONS[self.resolution]:
|
136 |
raise ValueError(f"Wrong height, width pair. Available (height, width) are: {self.RESOLUTIONS[self.resolution]}")
|
137 |
|
138 |
+
if num_steps != 4:
|
139 |
raise NotImplementedError(f"In the distilled version number of steps have to be strictly equal to 4")
|
140 |
|
141 |
# PREPARATION
|
|
|
198 |
return_images.append(ToPILImage()(image))
|
199 |
return return_images
|
200 |
else:
|
201 |
+
torchvision.io.write_video(save_path, 255. * images.squeeze(0).float().permute(1, 2, 3, 0).cpu().numpy(), fps=23, options = {"crf": "5"})
|