Spaces:
Running
on
Zero
Running
on
Zero
Update optimized.py
Browse files- optimized.py +14 -1
optimized.py
CHANGED
@@ -12,7 +12,20 @@ def self_attention_slicing(module, slice_size=3):
|
|
12 |
"""Modified from Diffusers' original for Flux compatibility"""
|
13 |
def sliced_attention(*args, **kwargs):
|
14 |
return module(*args, **kwargs) # Remove dummy implementation <source_id data="pipeline_flux_controlnet.py" />
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
# Device management - critical fix
|
17 |
pipe = FluxControlNetPipeline.from_pretrained(
|
18 |
"LPX55/FLUX.1-merged_uncensored",
|
|
|
12 |
"""Modified from Diffusers' original for Flux compatibility"""
|
13 |
def sliced_attention(*args, **kwargs):
|
14 |
return module(*args, **kwargs) # Remove dummy implementation <source_id data="pipeline_flux_controlnet.py" />
|
15 |
+
|
16 |
+
huggingface_token = os.getenv("HUGGINFACE_TOKEN")
|
17 |
+
# good_vae = AutoencoderKL.from_pretrained(
|
18 |
+
# "black-forest-labs/FLUX.1-dev",
|
19 |
+
# subfolder="vae",
|
20 |
+
# torch_dtype=torch.bfloat16,
|
21 |
+
# use_safetensors=True,
|
22 |
+
# device_map=None, # Disable automatic mapping
|
23 |
+
# token=huggingface_token
|
24 |
+
# )
|
25 |
+
controlnet = FluxControlNetModel.from_pretrained(
|
26 |
+
"jasperai/Flux.1-dev-Controlnet-Upscaler",
|
27 |
+
torch_dtype=torch.bfloat16
|
28 |
+
)
|
29 |
# Device management - critical fix
|
30 |
pipe = FluxControlNetPipeline.from_pretrained(
|
31 |
"LPX55/FLUX.1-merged_uncensored",
|