Spaces:
Runtime error
Runtime error
Commit
·
dc6ab63
1
Parent(s):
540eaa1
update
Browse files- app.py +10 -2
- requirements.txt +3 -3
app.py
CHANGED
@@ -23,8 +23,16 @@ snapshot_download(
|
|
23 |
|
24 |
# global variable
|
25 |
MAX_SEED = np.iinfo(np.int32).max
|
26 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
27 |
-
dtype = torch.float16 if str(device).__contains__("cuda") else torch.float32
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
# initialization
|
30 |
base_model_path = "stabilityai/stable-diffusion-xl-base-1.0"
|
|
|
23 |
|
24 |
# global variable
|
25 |
MAX_SEED = np.iinfo(np.int32).max
|
26 |
+
#device = "cuda" if torch.cuda.is_available() else "cpu"
|
27 |
+
#dtype = torch.float16 if str(device).__contains__("cuda") else torch.float32
|
28 |
+
if torch.cuda.is_available():
|
29 |
+
device = torch.device("cuda")
|
30 |
+
elif torch.backends.mps.is_available():
|
31 |
+
device = torch.device("mps")
|
32 |
+
else:
|
33 |
+
device = torch.device("cpu")
|
34 |
+
dtype = torch.float16 if str(device).__contains__("cuda") or str(device).__contains__("mps") else torch.float32
|
35 |
+
|
36 |
|
37 |
# initialization
|
38 |
base_model_path = "stabilityai/stable-diffusion-xl-base-1.0"
|
requirements.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
diffusers==0.27.2
|
2 |
-
torch>=2.0.0
|
3 |
-
torchvision>=0.15.1
|
4 |
transformers>=4.37.1
|
5 |
accelerate
|
6 |
safetensors
|
@@ -13,4 +13,4 @@ opencv-python
|
|
13 |
gradio
|
14 |
controlnet_aux
|
15 |
gdown
|
16 |
-
peft
|
|
|
1 |
diffusers==0.27.2
|
2 |
+
#torch>=2.0.0
|
3 |
+
#torchvision>=0.15.1
|
4 |
transformers>=4.37.1
|
5 |
accelerate
|
6 |
safetensors
|
|
|
13 |
gradio
|
14 |
controlnet_aux
|
15 |
gdown
|
16 |
+
peft
|