Skip to content

Commit

Permalink
Add VAE selector to the Parameter Generator node #15
Browse files Browse the repository at this point in the history
  • Loading branch information
receyuki committed Nov 21, 2023
1 parent d02265d commit fc11266
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,10 @@ def INPUT_TYPES(s):
"ckpt_name": (folder_paths.get_filename_list("checkpoints"),),
},
"optional": {
"vae_name": (
["baked VAE"] + folder_paths.get_filename_list("vae"),
{"default": "baked VAE"},
),
"model_version": (
list(SDParameterGenerator.MODEL_SCALING_FACTOR.keys()),
{"default": "SDv1 512px"},
Expand Down Expand Up @@ -586,8 +590,9 @@ def INPUT_TYPES(s):

def generate_parameter(
self,
model_version,
ckpt_name,
vae_name,
model_version,
config_name,
seed,
steps,
Expand Down Expand Up @@ -622,6 +627,12 @@ def generate_parameter(
embedding_directory=folder_paths.get_folder_paths("embeddings"),
)[:3]

if vae_name != "baked VAE":
vae_path = folder_paths.get_full_path("vae", vae_name)
sd = comfy.utils.load_torch_file(vae_path)
vae = comfy.sd.VAE(sd=sd)
checkpoint = (*checkpoint[:2], vae)

if aspect_ratio != "custom":
aspect_ratio_value = aspect_ratio.split(" - ")[0]
width = int(
Expand Down

0 comments on commit fc11266

Please sign in to comment.