Spaces:
Running
on
Zero
Running
on
Zero
gpu / cpu
Browse files- demo/img_gen.py +5 -2
- demo/relighting_gen.py +5 -2
demo/img_gen.py
CHANGED
@@ -7,8 +7,11 @@ from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
|
|
7 |
|
8 |
model_id = "stabilityai/stable-diffusion-2-1"
|
9 |
|
10 |
-
device = torch.device('
|
11 |
-
dtype = torch.
|
|
|
|
|
|
|
12 |
|
13 |
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=dtype)
|
14 |
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
|
|
|
7 |
|
8 |
model_id = "stabilityai/stable-diffusion-2-1"
|
9 |
|
10 |
+
device = torch.device('cpu')
|
11 |
+
dtype = torch.float32
|
12 |
+
if torch.cuda.is_available():
|
13 |
+
device = torch.device('cuda')
|
14 |
+
dtype = torch.float16
|
15 |
|
16 |
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=dtype)
|
17 |
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
|
demo/relighting_gen.py
CHANGED
@@ -7,8 +7,11 @@ from diffusers.utils import get_class_from_dynamic_module
|
|
7 |
|
8 |
from tqdm import tqdm
|
9 |
|
10 |
-
device = torch.device('
|
11 |
-
dtype = torch.
|
|
|
|
|
|
|
12 |
|
13 |
NeuralTextureControlNetModel = get_class_from_dynamic_module(
|
14 |
"dilightnet/model_helpers",
|
|
|
7 |
|
8 |
from tqdm import tqdm
|
9 |
|
10 |
+
device = torch.device('cpu')
|
11 |
+
dtype = torch.float32
|
12 |
+
if torch.cuda.is_available():
|
13 |
+
device = torch.device('cuda')
|
14 |
+
dtype = torch.float16
|
15 |
|
16 |
NeuralTextureControlNetModel = get_class_from_dynamic_module(
|
17 |
"dilightnet/model_helpers",
|