Spaces:
Running
on
Zero
Running
on
Zero
Upload app.py
Browse files
app.py
CHANGED
@@ -33,9 +33,9 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
33 |
base_model = models[0]
|
34 |
controlnet_model_union_repo = 'InstantX/FLUX.1-dev-Controlnet-Union'
|
35 |
#controlnet_model_union_repo = 'InstantX/FLUX.1-dev-Controlnet-Union-alpha'
|
36 |
-
taef1 = AutoencoderTiny.from_pretrained("madebyollin/taef1", torch_dtype=dtype)
|
37 |
-
good_vae = AutoencoderKL.from_pretrained(base_model, subfolder="vae", torch_dtype=dtype)
|
38 |
-
pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=dtype, vae=taef1)
|
39 |
controlnet_union = None
|
40 |
controlnet = None
|
41 |
last_model = models[0]
|
@@ -59,9 +59,9 @@ def change_base_model(repo_id: str, cn_on: bool):
|
|
59 |
#progress(0, desc=f"Loading model: {repo_id} / Loading ControlNet: {controlnet_model_union_repo}")
|
60 |
print(f"Loading model: {repo_id} / Loading ControlNet: {controlnet_model_union_repo}")
|
61 |
clear_cache()
|
62 |
-
controlnet_union = FluxControlNetModel.from_pretrained(controlnet_model_union_repo, torch_dtype=dtype)
|
63 |
-
controlnet = FluxMultiControlNetModel([controlnet_union])
|
64 |
-
pipe = FluxControlNetPipeline.from_pretrained(repo_id, controlnet=controlnet, torch_dtype=dtype, vae=taef1)
|
65 |
pipe.flux_pipe_call_that_returns_an_iterable_of_images = flux_pipe_call_that_returns_an_iterable_of_images.__get__(pipe)
|
66 |
last_model = repo_id
|
67 |
last_cn_on = cn_on
|
@@ -71,7 +71,7 @@ def change_base_model(repo_id: str, cn_on: bool):
|
|
71 |
#progress(0, desc=f"Loading model: {repo_id}")
|
72 |
print(f"Loading model: {repo_id}")
|
73 |
clear_cache()
|
74 |
-
pipe = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=dtype, vae=taef1)
|
75 |
pipe.flux_pipe_call_that_returns_an_iterable_of_images = flux_pipe_call_that_returns_an_iterable_of_images.__get__(pipe)
|
76 |
last_model = repo_id
|
77 |
last_cn_on = cn_on
|
|
|
33 |
base_model = models[0]
|
34 |
controlnet_model_union_repo = 'InstantX/FLUX.1-dev-Controlnet-Union'
|
35 |
#controlnet_model_union_repo = 'InstantX/FLUX.1-dev-Controlnet-Union-alpha'
|
36 |
+
taef1 = AutoencoderTiny.from_pretrained("madebyollin/taef1", torch_dtype=dtype).to(device)
|
37 |
+
good_vae = AutoencoderKL.from_pretrained(base_model, subfolder="vae", torch_dtype=dtype).to(device)
|
38 |
+
pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=dtype, vae=taef1).to(device)
|
39 |
controlnet_union = None
|
40 |
controlnet = None
|
41 |
last_model = models[0]
|
|
|
59 |
#progress(0, desc=f"Loading model: {repo_id} / Loading ControlNet: {controlnet_model_union_repo}")
|
60 |
print(f"Loading model: {repo_id} / Loading ControlNet: {controlnet_model_union_repo}")
|
61 |
clear_cache()
|
62 |
+
controlnet_union = FluxControlNetModel.from_pretrained(controlnet_model_union_repo, torch_dtype=dtype).to(device)
|
63 |
+
controlnet = FluxMultiControlNetModel([controlnet_union]).to(device)
|
64 |
+
pipe = FluxControlNetPipeline.from_pretrained(repo_id, controlnet=controlnet, torch_dtype=dtype, vae=taef1).to(device)
|
65 |
pipe.flux_pipe_call_that_returns_an_iterable_of_images = flux_pipe_call_that_returns_an_iterable_of_images.__get__(pipe)
|
66 |
last_model = repo_id
|
67 |
last_cn_on = cn_on
|
|
|
71 |
#progress(0, desc=f"Loading model: {repo_id}")
|
72 |
print(f"Loading model: {repo_id}")
|
73 |
clear_cache()
|
74 |
+
pipe = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=dtype, vae=taef1).to(device)
|
75 |
pipe.flux_pipe_call_that_returns_an_iterable_of_images = flux_pipe_call_that_returns_an_iterable_of_images.__get__(pipe)
|
76 |
last_model = repo_id
|
77 |
last_cn_on = cn_on
|