Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -70,35 +70,16 @@ tokenizer_3 = AutoTokenizer.from_pretrained(
|
|
70 |
# Ensure model and scheduler are initialized in GPU-enabled function
|
71 |
if torch.cuda.is_available():
|
72 |
pipe = StableDiffusion3Pipeline.from_pretrained(
|
73 |
-
repo,
|
|
|
|
|
74 |
torch_dtype=torch.float16).to("cuda")
|
75 |
pipe2 = StableDiffusion3Img2ImgPipeline.from_pretrained(
|
76 |
-
repo,
|
|
|
|
|
77 |
torch_dtype=torch.float16).to("cuda")
|
78 |
|
79 |
-
torch.set_float32_matmul_precision("high")
|
80 |
-
|
81 |
-
torch._inductor.config.conv_1x1_as_mm = True
|
82 |
-
torch._inductor.config.coordinate_descent_tuning = True
|
83 |
-
torch._inductor.config.epilogue_fusion = False
|
84 |
-
torch._inductor.config.coordinate_descent_check_all_directions = True
|
85 |
-
|
86 |
-
pipe.set_progress_bar_config(disable=True)
|
87 |
-
|
88 |
-
pipe.transformer.to(memory_format=torch.channels_last)
|
89 |
-
pipe.vae.to(memory_format=torch.channels_last)
|
90 |
-
|
91 |
-
pipe.transformer = torch.compile(pipe.transformer, mode="max-autotune", fullgraph=True)
|
92 |
-
pipe.vae.decode = torch.compile(pipe.vae.decode, mode="max-autotune", fullgraph=True)
|
93 |
-
|
94 |
-
|
95 |
-
pipe2.set_progress_bar_config(disable=True)
|
96 |
-
|
97 |
-
pipe2.transformer.to(memory_format=torch.channels_last)
|
98 |
-
pipe2.vae.to(memory_format=torch.channels_last)
|
99 |
-
|
100 |
-
pipe2.transformer = torch.compile(pipe2.transformer, mode="max-autotune", fullgraph=True)
|
101 |
-
pipe2.vae.decode = torch.compile(pipe2.vae.decode, mode="max-autotune", fullgraph=True)
|
102 |
|
103 |
|
104 |
pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_config(pipe.scheduler.config)
|
|
|
70 |
# Ensure model and scheduler are initialized in GPU-enabled function
|
71 |
if torch.cuda.is_available():
|
72 |
pipe = StableDiffusion3Pipeline.from_pretrained(
|
73 |
+
repo,
|
74 |
+
vae=vae,
|
75 |
+
transformer=transformer,
|
76 |
torch_dtype=torch.float16).to("cuda")
|
77 |
pipe2 = StableDiffusion3Img2ImgPipeline.from_pretrained(
|
78 |
+
repo,
|
79 |
+
vae=vae,
|
80 |
+
transformer=transformer,
|
81 |
torch_dtype=torch.float16).to("cuda")
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
|
84 |
|
85 |
pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_config(pipe.scheduler.config)
|