Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -67,13 +67,28 @@ tokenizer_3 = AutoTokenizer.from_pretrained(
|
|
| 67 |
|
| 68 |
# Ensure model and scheduler are initialized in GPU-enabled function
|
| 69 |
if torch.cuda.is_available():
|
| 70 |
-
pipe = StableDiffusion3Pipeline.from_pretrained(
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_config(pipe.scheduler.config)
|
| 74 |
pipe2.scheduler = FlowMatchEulerDiscreteScheduler.from_config(pipe2.scheduler.config)
|
| 75 |
|
| 76 |
-
print(pipe.
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
# Function
|
| 79 |
@spaces.GPU()
|
|
|
|
| 67 |
|
| 68 |
# Ensure model and scheduler are initialized in GPU-enabled function
|
| 69 |
if torch.cuda.is_available():
|
| 70 |
+
pipe = StableDiffusion3Pipeline.from_pretrained(
|
| 71 |
+
repo,
|
| 72 |
+
vae=vae,
|
| 73 |
+
transformer=transformer,
|
| 74 |
+
tokenizer_3=tokenizer_3,
|
| 75 |
+
text_encoder_3=text_encoder_3,
|
| 76 |
+
torch_dtype=torch.float16).to("cuda")
|
| 77 |
+
pipe2 = StableDiffusion3Img2ImgPipeline.from_pretrained(
|
| 78 |
+
repo,
|
| 79 |
+
vae=vae,
|
| 80 |
+
transformer=transformer,
|
| 81 |
+
tokenizer_3=tokenizer_3,
|
| 82 |
+
text_encoder_3=text_encoder_3,
|
| 83 |
+
torch_dtype=torch.float16).to("cuda")
|
| 84 |
|
| 85 |
pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_config(pipe.scheduler.config)
|
| 86 |
pipe2.scheduler = FlowMatchEulerDiscreteScheduler.from_config(pipe2.scheduler.config)
|
| 87 |
|
| 88 |
+
print(pipe.tokenizer.model_max_length)
|
| 89 |
+
print(pipe.tokenizer_3.model_max_length)
|
| 90 |
+
|
| 91 |
+
pipe.tokenizer_max_length=512
|
| 92 |
|
| 93 |
# Function
|
| 94 |
@spaces.GPU()
|