Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,14 +11,22 @@ dtype = torch.float16 if device == "cuda" else torch.float32
|
|
| 11 |
|
| 12 |
pipe = DiffusionPipeline.from_pretrained(
|
| 13 |
"stable-diffusion-v1-5/stable-diffusion-v1-5",
|
| 14 |
-
torch_dtype=torch.
|
| 15 |
-
cache_dir="/tmp/huggingface"
|
|
|
|
|
|
|
| 16 |
)
|
| 17 |
|
|
|
|
|
|
|
| 18 |
# device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 19 |
|
| 20 |
pipe.to(device)
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
# pipe.unet.load_attn_procs(
|
| 23 |
# "./pytorch_custom_diffusion_weights.bin"
|
| 24 |
# )
|
|
|
|
| 11 |
|
| 12 |
pipe = DiffusionPipeline.from_pretrained(
|
| 13 |
"stable-diffusion-v1-5/stable-diffusion-v1-5",
|
| 14 |
+
torch_dtype=torch.float16 if device=="cuda" else torch.float32,
|
| 15 |
+
cache_dir="/tmp/huggingface",
|
| 16 |
+
use_safetensors=True,
|
| 17 |
+
safety_checker=None
|
| 18 |
)
|
| 19 |
|
| 20 |
+
# pipe.safety_checker = None
|
| 21 |
+
|
| 22 |
# device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 23 |
|
| 24 |
pipe.to(device)
|
| 25 |
|
| 26 |
+
pipe.enable_attention_slicing()
|
| 27 |
+
pipe.enable_model_cpu_offload()
|
| 28 |
+
|
| 29 |
+
|
| 30 |
# pipe.unet.load_attn_procs(
|
| 31 |
# "./pytorch_custom_diffusion_weights.bin"
|
| 32 |
# )
|