Spaces:
Paused
Paused
revert
Browse files
app.py
CHANGED
|
@@ -6,26 +6,15 @@ import gradio as gr
|
|
| 6 |
import numpy as np
|
| 7 |
import random
|
| 8 |
import torch
|
| 9 |
-
from diffusers import FluxPipeline
|
| 10 |
-
from torchao.quantization import quantize_, int8_weight_only
|
| 11 |
from sd_embed.embedding_funcs import get_weighted_text_embeddings_flux1
|
| 12 |
|
| 13 |
dtype = torch.bfloat16
|
| 14 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
)
|
| 19 |
-
quantize_(transformer, int8_weight_only())
|
| 20 |
-
|
| 21 |
-
pipe = DiffusionPipeline.from_pretrained(
|
| 22 |
-
"black-forest-labs/FLUX.1-dev", transformer=transformer, torch_dtype=torch.bfloat16
|
| 23 |
)
|
| 24 |
-
|
| 25 |
-
# pipe = FluxPipeline.from_pretrained(
|
| 26 |
-
# "black-forest-labs/FLUX.1-dev",
|
| 27 |
-
# torch_dtype=dtype,
|
| 28 |
-
# )
|
| 29 |
pipe.to(device)
|
| 30 |
|
| 31 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
|
| 6 |
import numpy as np
|
| 7 |
import random
|
| 8 |
import torch
|
| 9 |
+
from diffusers import FluxPipeline
|
|
|
|
| 10 |
from sd_embed.embedding_funcs import get_weighted_text_embeddings_flux1
|
| 11 |
|
| 12 |
dtype = torch.bfloat16
|
| 13 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 14 |
+
pipe = FluxPipeline.from_pretrained(
|
| 15 |
+
"black-forest-labs/FLUX.1-dev",
|
| 16 |
+
torch_dtype=dtype,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
pipe.to(device)
|
| 19 |
|
| 20 |
MAX_SEED = np.iinfo(np.int32).max
|