Spaces:
Runtime error
Runtime error
Update app.py
#13
by
Aditibaheti
- opened
app.py
CHANGED
|
@@ -5,17 +5,9 @@ from diffusers import DiffusionPipeline
|
|
| 5 |
import torch
|
| 6 |
from huggingface_hub import login
|
| 7 |
import os
|
| 8 |
-
import sys
|
| 9 |
-
import subprocess
|
| 10 |
|
| 11 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 12 |
|
| 13 |
-
# Install xformers if not already installed
|
| 14 |
-
try:
|
| 15 |
-
import xformers
|
| 16 |
-
except ImportError:
|
| 17 |
-
subprocess.check_call([sys.executable, "-m", "pip", "install", "xformers"])
|
| 18 |
-
|
| 19 |
# Set your Hugging Face token
|
| 20 |
HUGGINGFACE_TOKEN = os.getenv("HUGGINGFACE_TOKEN")
|
| 21 |
login(token=HUGGINGFACE_TOKEN)
|
|
@@ -34,7 +26,6 @@ pipeline.load_lora_weights(lora_weights_path)
|
|
| 34 |
|
| 35 |
if device == "cuda":
|
| 36 |
pipeline.enable_sequential_cpu_offload() # Efficient memory usage
|
| 37 |
-
pipeline.enable_xformers_memory_efficient_attention() # Enable xformers memory efficient attention
|
| 38 |
|
| 39 |
pipeline = pipeline.to(device)
|
| 40 |
|
|
|
|
| 5 |
import torch
|
| 6 |
from huggingface_hub import login
|
| 7 |
import os
|
|
|
|
|
|
|
| 8 |
|
| 9 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# Set your Hugging Face token
|
| 12 |
HUGGINGFACE_TOKEN = os.getenv("HUGGINGFACE_TOKEN")
|
| 13 |
login(token=HUGGINGFACE_TOKEN)
|
|
|
|
| 26 |
|
| 27 |
if device == "cuda":
|
| 28 |
pipeline.enable_sequential_cpu_offload() # Efficient memory usage
|
|
|
|
| 29 |
|
| 30 |
pipeline = pipeline.to(device)
|
| 31 |
|