Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
-
import spaces
|
4 |
from diffusers import DiffusionPipeline
|
5 |
-
from accelerate import load_checkpoint_and_dispatch
|
6 |
|
7 |
# Configuración para usar bfloat16 y CUDA si está disponible
|
8 |
dtype = torch.bfloat16
|
@@ -14,6 +13,9 @@ pipe = None
|
|
14 |
def load_model():
|
15 |
global pipe
|
16 |
if pipe is None:
|
|
|
|
|
|
|
17 |
pipe = DiffusionPipeline.from_pretrained(
|
18 |
"black-forest-labs/FLUX.1-schnell",
|
19 |
torch_dtype=dtype
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
|
|
3 |
from diffusers import DiffusionPipeline
|
4 |
+
from accelerate import init_empty_weights, load_checkpoint_and_dispatch, infer_auto_device_map
|
5 |
|
6 |
# Configuración para usar bfloat16 y CUDA si está disponible
|
7 |
dtype = torch.bfloat16
|
|
|
13 |
def load_model():
|
14 |
global pipe
|
15 |
if pipe is None:
|
16 |
+
# Inicializar ZeroGPU antes de cargar el modelo
|
17 |
+
init_empty_weights()
|
18 |
+
|
19 |
pipe = DiffusionPipeline.from_pretrained(
|
20 |
"black-forest-labs/FLUX.1-schnell",
|
21 |
torch_dtype=dtype
|