Spaces:
Runtime error
Runtime error
Update video_diffusion/inpaint_zoom/zoom_in_app.py
Browse files
video_diffusion/inpaint_zoom/zoom_in_app.py
CHANGED
|
@@ -8,6 +8,11 @@ from PIL import Image
|
|
| 8 |
|
| 9 |
from video_diffusion.inpaint_zoom.utils.zoom_in_utils import dummy, image_grid, shrink_and_paste_on_blank, write_video
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
|
| 12 |
|
| 13 |
|
|
@@ -31,11 +36,11 @@ class StableDiffusionZoomIn:
|
|
| 31 |
if self.pipe is None:
|
| 32 |
self.pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, revision="fp16")
|
| 33 |
self.pipe.scheduler = DPMSolverMultistepScheduler.from_config(self.pipe.scheduler.config)
|
| 34 |
-
self.pipe = self.pipe.to(
|
| 35 |
self.pipe.safety_checker = dummy
|
| 36 |
self.pipe.enable_attention_slicing()
|
| 37 |
self.pipe.enable_xformers_memory_efficient_attention()
|
| 38 |
-
self.g_cuda = torch.Generator(device=
|
| 39 |
|
| 40 |
return self.pipe
|
| 41 |
|
|
|
|
| 8 |
|
| 9 |
from video_diffusion.inpaint_zoom.utils.zoom_in_utils import dummy, image_grid, shrink_and_paste_on_blank, write_video
|
| 10 |
|
| 11 |
+
if torch.cuda.is_available():
|
| 12 |
+
device = torch.device("cuda")
|
| 13 |
+
else:
|
| 14 |
+
device = torch.device("cpu")
|
| 15 |
+
|
| 16 |
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
|
| 17 |
|
| 18 |
|
|
|
|
| 36 |
if self.pipe is None:
|
| 37 |
self.pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, revision="fp16")
|
| 38 |
self.pipe.scheduler = DPMSolverMultistepScheduler.from_config(self.pipe.scheduler.config)
|
| 39 |
+
self.pipe = self.pipe.to(device)
|
| 40 |
self.pipe.safety_checker = dummy
|
| 41 |
self.pipe.enable_attention_slicing()
|
| 42 |
self.pipe.enable_xformers_memory_efficient_attention()
|
| 43 |
+
self.g_cuda = torch.Generator(device=device)
|
| 44 |
|
| 45 |
return self.pipe
|
| 46 |
|