Fix custom vae path (#1317)

This commit is contained in:
jinchen62
2023-04-18 20:50:43 -07:00
committed by GitHub
parent 747ed383b1
commit bda92a54ab
9 changed files with 31 additions and 24 deletions

View File

@@ -69,6 +69,7 @@ def inpaint_inf(
# set ckpt_loc and hf_model_id.
args.ckpt_loc = ""
args.hf_model_id = ""
args.custom_vae = ""
if custom_model == "None":
if not hf_model_id:
return (
@@ -80,7 +81,8 @@ def inpaint_inf(
args.ckpt_loc = get_custom_model_pathfile(custom_model)
else:
args.hf_model_id = custom_model
args.custom_vae = custom_vae
if custom_vae != "None":
args.custom_vae = get_custom_model_pathfile(custom_vae, model="vae")
args.use_lora = get_custom_vae_or_lora_weights(
lora_weights, lora_hf_id, "lora"
@@ -95,6 +97,7 @@ def inpaint_inf(
"inpaint",
args.hf_model_id,
args.ckpt_loc,
args.custom_vae,
precision,
batch_size,
max_length,

View File

@@ -71,6 +71,7 @@ def outpaint_inf(
# set ckpt_loc and hf_model_id.
args.ckpt_loc = ""
args.hf_model_id = ""
args.custom_vae = ""
if custom_model == "None":
if not hf_model_id:
return (
@@ -82,7 +83,8 @@ def outpaint_inf(
args.ckpt_loc = get_custom_model_pathfile(custom_model)
else:
args.hf_model_id = custom_model
args.custom_vae = custom_vae
if custom_vae != "None":
args.custom_vae = get_custom_model_pathfile(custom_vae, model="vae")
args.use_lora = get_custom_vae_or_lora_weights(
lora_weights, lora_hf_id, "lora"
@@ -97,6 +99,7 @@ def outpaint_inf(
"outpaint",
args.hf_model_id,
args.ckpt_loc,
args.custom_vae,
precision,
batch_size,
max_length,

View File

@@ -67,6 +67,7 @@ def upscaler_inf(
# set ckpt_loc and hf_model_id.
args.ckpt_loc = ""
args.hf_model_id = ""
args.custom_vae = ""
if custom_model == "None":
if not hf_model_id:
return (
@@ -78,7 +79,8 @@ def upscaler_inf(
args.ckpt_loc = get_custom_model_pathfile(custom_model)
else:
args.hf_model_id = custom_model
args.custom_vae = custom_vae
if custom_vae != "None":
args.custom_vae = get_custom_model_pathfile(custom_vae, model="vae")
args.save_metadata_to_json = save_metadata_to_json
args.write_metadata_to_png = save_metadata_to_png
@@ -95,6 +97,7 @@ def upscaler_inf(
"upscaler",
args.hf_model_id,
args.ckpt_loc,
args.custom_vae,
precision,
batch_size,
max_length,

View File

@@ -92,6 +92,7 @@ def img2img_inf(
# set ckpt_loc and hf_model_id.
args.ckpt_loc = ""
args.hf_model_id = ""
args.custom_vae = ""
if custom_model == "None":
if not hf_model_id:
return (
@@ -103,7 +104,8 @@ def img2img_inf(
args.ckpt_loc = get_custom_model_pathfile(custom_model)
else:
args.hf_model_id = custom_model
args.custom_vae = custom_vae
if custom_vae != "None":
args.custom_vae = get_custom_model_pathfile(custom_vae, model="vae")
args.use_lora = get_custom_vae_or_lora_weights(
lora_weights, lora_hf_id, "lora"
@@ -130,6 +132,7 @@ def img2img_inf(
"img2img",
args.hf_model_id,
args.ckpt_loc,
args.custom_vae,
precision,
batch_size,
max_length,
@@ -354,14 +357,12 @@ with gr.Blocks(title="Image-to-Image") as img2img_web:
lines=3,
)
custom_vae = gr.Dropdown(
label=f"Custom Vae Models",
label=f"Custom Vae Models (Path: {get_custom_model_path('vae')})",
elem_id="custom_model",
value=os.path.basename(args.custom_vae)
if args.custom_vae
else "None",
choices=["None"]
+ get_custom_model_files()
+ predefined_models,
choices=["None"] + get_custom_model_files("vae"),
)
with gr.Group(elem_id="prompt_box_outer"):

View File

@@ -48,14 +48,12 @@ with gr.Blocks(title="Inpainting") as inpaint_web:
lines=3,
)
custom_vae = gr.Dropdown(
label=f"Custom Vae Models",
label=f"Custom Vae Models (Path: {get_custom_model_path('vae')})",
elem_id="custom_model",
value=os.path.basename(args.custom_vae)
if args.custom_vae
else "None",
choices=["None"]
+ get_custom_model_files()
+ predefined_paint_models,
choices=["None"] + get_custom_model_files("vae"),
)
with gr.Group(elem_id="prompt_box_outer"):

View File

@@ -48,14 +48,12 @@ with gr.Blocks(title="Outpainting") as outpaint_web:
lines=3,
)
custom_vae = gr.Dropdown(
label=f"Custom Vae Models",
label=f"Custom Vae Models (Path: {get_custom_model_path('vae')})",
elem_id="custom_model",
value=os.path.basename(args.custom_vae)
if args.custom_vae
else "None",
choices=["None"]
+ get_custom_model_files()
+ predefined_paint_models,
choices=["None"] + get_custom_model_files("vae"),
)
with gr.Group(elem_id="prompt_box_outer"):

View File

@@ -74,6 +74,7 @@ def txt2img_inf(
# set ckpt_loc and hf_model_id.
args.ckpt_loc = ""
args.hf_model_id = ""
args.custom_vae = ""
if custom_model == "None":
if not hf_model_id:
return (
@@ -85,7 +86,8 @@ def txt2img_inf(
args.ckpt_loc = get_custom_model_pathfile(custom_model)
else:
args.hf_model_id = custom_model
args.custom_vae = custom_vae
if custom_vae != "None":
args.custom_vae = get_custom_model_pathfile(custom_vae, model="vae")
args.save_metadata_to_json = save_metadata_to_json
args.write_metadata_to_png = save_metadata_to_png
@@ -100,6 +102,7 @@ def txt2img_inf(
"txt2img",
args.hf_model_id,
args.ckpt_loc,
args.custom_vae,
precision,
batch_size,
max_length,
@@ -232,14 +235,13 @@ with gr.Blocks(title="Text-to-Image") as txt2img_web:
lines=3,
)
custom_vae = gr.Dropdown(
label=f"Custom Vae Models",
label=f"Custom Vae Models (Path: {get_custom_model_path('vae')})",
elem_id="custom_model",
value=os.path.basename(args.custom_vae)
if args.custom_vae
else "None",
choices=["None"]
+ get_custom_model_files()
+ predefined_models,
+ get_custom_model_files("vae"),
)
with gr.Column(scale=1, min_width=170):
png_info_img = gr.Image(

View File

@@ -47,14 +47,12 @@ with gr.Blocks(title="Upscaler") as upscaler_web:
lines=3,
)
custom_vae = gr.Dropdown(
label=f"Custom Vae Models",
label=f"Custom Vae Models (Path: {get_custom_model_path('vae')})",
elem_id="custom_model",
value=os.path.basename(args.custom_vae)
if args.custom_vae
else "None",
choices=["None"]
+ get_custom_model_files()
+ predefined_upscaler_models,
choices=["None"] + get_custom_model_files("vae"),
)
with gr.Group(elem_id="prompt_box_outer"):

View File

@@ -16,6 +16,7 @@ class Config:
mode: str
model_id: str
ckpt_loc: str
custom_vae: str
precision: str
batch_size: int
max_length: int