Spaces:
Runtime error
Runtime error
lionelgarnier
commited on
Commit
·
470ecaf
1
Parent(s):
40dbd0f
tokenizer flux
Browse files
app.py
CHANGED
@@ -24,9 +24,15 @@ def get_image_gen_pipeline():
|
|
24 |
try:
|
25 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
26 |
dtype = torch.bfloat16
|
|
|
|
|
|
|
|
|
|
|
27 |
_image_gen_pipeline = DiffusionPipeline.from_pretrained(
|
28 |
"black-forest-labs/FLUX.1-schnell",
|
29 |
-
torch_dtype=dtype
|
|
|
30 |
).to(device)
|
31 |
except Exception as e:
|
32 |
print(f"Error loading image generation model: {e}")
|
@@ -295,8 +301,11 @@ def create_interface():
|
|
295 |
)
|
296 |
|
297 |
gr.Examples(
|
298 |
-
examples=
|
299 |
-
|
|
|
|
|
|
|
300 |
inputs=[prompt],
|
301 |
outputs=[generated_image, seed],
|
302 |
cache_examples=True,
|
|
|
24 |
try:
|
25 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
26 |
dtype = torch.bfloat16
|
27 |
+
# Load fast tokenizer for the image pipeline
|
28 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
29 |
+
"black-forest-labs/FLUX.1-schnell",
|
30 |
+
use_fast=True
|
31 |
+
)
|
32 |
_image_gen_pipeline = DiffusionPipeline.from_pretrained(
|
33 |
"black-forest-labs/FLUX.1-schnell",
|
34 |
+
torch_dtype=dtype,
|
35 |
+
tokenizer=tokenizer
|
36 |
).to(device)
|
37 |
except Exception as e:
|
38 |
print(f"Error loading image generation model: {e}")
|
|
|
301 |
)
|
302 |
|
303 |
gr.Examples(
|
304 |
+
examples=[
|
305 |
+
"a backpack for kids, flower style",
|
306 |
+
"medieval flip flops",
|
307 |
+
"cat shaped cake mold"
|
308 |
+
],
|
309 |
inputs=[prompt],
|
310 |
outputs=[generated_image, seed],
|
311 |
cache_examples=True,
|