Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,20 +1,12 @@
|
|
| 1 |
import torch
|
| 2 |
from diffusers import FluxPipeline
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 6 |
-
|
| 7 |
-
# 2. Cargar el modelo con cuantizaci贸n (si tienes bitsandbytes instalado)
|
| 8 |
-
# Si sigues teniendo error de memoria, intenta usar "black-forest-labs/FLUX.1-schnell"
|
| 9 |
pipe = FluxPipeline.from_pretrained(
|
| 10 |
"black-forest-labs/FLUX.1-dev",
|
| 11 |
-
torch_dtype=torch.
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
)
|
| 15 |
-
|
| 16 |
-
# 3. Mover el pipeline a la GPU despu茅s de cargarlo
|
| 17 |
-
pipe.to(device)
|
| 18 |
|
| 19 |
-
#
|
| 20 |
pipe.load_lora_weights("joyfox/Kontext-Cosplay-Lora", weight_name="kontext_cosplay_lora_20000.safetensors")
|
|
|
|
| 1 |
import torch
|
| 2 |
from diffusers import FluxPipeline
|
| 3 |
|
| 4 |
+
# Usamos la variante en precisi贸n FP8, que reduce la huella de memoria a la mitad
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
pipe = FluxPipeline.from_pretrained(
|
| 6 |
"black-forest-labs/FLUX.1-dev",
|
| 7 |
+
torch_dtype=torch.float8_e4m3fn,
|
| 8 |
+
device_map="balanced"
|
| 9 |
+
).to("cuda")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
# Cargar el LoRA
|
| 12 |
pipe.load_lora_weights("joyfox/Kontext-Cosplay-Lora", weight_name="kontext_cosplay_lora_20000.safetensors")
|