Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,13 +6,16 @@ import torch
|
|
| 6 |
|
| 7 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 8 |
|
|
|
|
|
|
|
|
|
|
| 9 |
if torch.cuda.is_available():
|
| 10 |
torch.cuda.max_memory_allocated(device=device)
|
| 11 |
-
pipe = DiffusionPipeline.from_pretrained(
|
| 12 |
pipe.enable_xformers_memory_efficient_attention()
|
| 13 |
pipe = pipe.to(device)
|
| 14 |
else:
|
| 15 |
-
pipe = DiffusionPipeline.from_pretrained(
|
| 16 |
pipe = pipe.to(device)
|
| 17 |
|
| 18 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
|
| 6 |
|
| 7 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 8 |
|
| 9 |
+
# Replace 'path/to/your/safetensors' with the actual path to your fine-tuned model's safetensors file
|
| 10 |
+
model_path = "pytorch_lora_weights.safetensors"
|
| 11 |
+
|
| 12 |
if torch.cuda.is_available():
|
| 13 |
torch.cuda.max_memory_allocated(device=device)
|
| 14 |
+
pipe = DiffusionPipeline.from_pretrained(model_path, torch_dtype=torch.float16, variant="fp16", use_safetensors=True)
|
| 15 |
pipe.enable_xformers_memory_efficient_attention()
|
| 16 |
pipe = pipe.to(device)
|
| 17 |
else:
|
| 18 |
+
pipe = DiffusionPipeline.from_pretrained(model_path, use_safetensors=True)
|
| 19 |
pipe = pipe.to(device)
|
| 20 |
|
| 21 |
MAX_SEED = np.iinfo(np.int32).max
|