Add AuraFlow architecture model.
Browse files- .gitattributes +35 -4
- app.py +36 -6
- chain_injectors/anima_controlnet_lllite_injector.py +6 -1
- comfy_integration/setup.py +1 -9
- core/pipelines/base_pipeline.py +14 -3
- core/pipelines/workflow_recipes/_partials/conditioning/auraflow.yaml +48 -0
- requirements.txt +2 -2
- ui/events/chain_handlers.py +19 -0
- ui/events/change_handlers.py +364 -364
- ui/layout.py +1 -9
- ui/shared/ui_components.py +1 -2
- yaml/anima_controlnet_lllite_models.yaml +5 -2
- yaml/constants.yaml +9 -0
- yaml/file_list.yaml +31 -17
- yaml/image_gen_features.yaml +6 -0
- yaml/model_architectures.yaml +4 -0
- yaml/model_defaults.yaml +18 -3
- yaml/model_list.yaml +10 -1
.gitattributes
CHANGED
|
@@ -1,4 +1,35 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
|
@@ -40,6 +40,21 @@ def apply_sage_attention_patch():
|
|
| 40 |
print(msg)
|
| 41 |
return msg
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
@spaces.GPU
|
| 44 |
def dummy_gpu_for_startup():
|
| 45 |
try:
|
|
@@ -49,10 +64,9 @@ def dummy_gpu_for_startup():
|
|
| 49 |
print("--- [GPU Startup] Startup check passed. ---")
|
| 50 |
return "Startup check passed."
|
| 51 |
except BaseException as e:
|
| 52 |
-
|
| 53 |
-
if "uncorrectable ECC error" in err_msg or "cudaErrorECCUncorrectable" in err_msg:
|
| 54 |
print("\n" + "="*80)
|
| 55 |
-
print(f"🚨 [Fatal GPU Error] Captured
|
| 56 |
print("🚨 Terminating process to trigger an automatic container restart...")
|
| 57 |
print("="*80 + "\n")
|
| 58 |
os._exit(1)
|
|
@@ -80,8 +94,15 @@ def main():
|
|
| 80 |
print("--- Initiating GPU Startup Check & SageAttention Patch Verification ---")
|
| 81 |
try:
|
| 82 |
dummy_gpu_for_startup()
|
| 83 |
-
except
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
print("--- Starting Application Setup ---")
|
| 87 |
|
|
@@ -99,7 +120,16 @@ def main():
|
|
| 99 |
demo = build_ui(attach_event_handlers)
|
| 100 |
|
| 101 |
print("--- Launching Gradio Interface ---")
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
|
| 105 |
if __name__ == "__main__":
|
|
|
|
| 40 |
print(msg)
|
| 41 |
return msg
|
| 42 |
|
| 43 |
+
def is_fatal_gpu_error(e: BaseException) -> bool:
|
| 44 |
+
err_type = type(e).__name__
|
| 45 |
+
err_str = f"{err_type}: {str(e)} | {repr(e)}".lower()
|
| 46 |
+
fatal_keywords = [
|
| 47 |
+
"ecc",
|
| 48 |
+
"uncorrectable",
|
| 49 |
+
"cudaerror",
|
| 50 |
+
"acceleratorerror",
|
| 51 |
+
"cuda error",
|
| 52 |
+
"cuda_error",
|
| 53 |
+
"device-side assertion",
|
| 54 |
+
"cuda_launch_blocking",
|
| 55 |
+
]
|
| 56 |
+
return any(kw in err_str for kw in fatal_keywords)
|
| 57 |
+
|
| 58 |
@spaces.GPU
|
| 59 |
def dummy_gpu_for_startup():
|
| 60 |
try:
|
|
|
|
| 64 |
print("--- [GPU Startup] Startup check passed. ---")
|
| 65 |
return "Startup check passed."
|
| 66 |
except BaseException as e:
|
| 67 |
+
if is_fatal_gpu_error(e):
|
|
|
|
| 68 |
print("\n" + "="*80)
|
| 69 |
+
print(f"🚨 [Fatal GPU Error] Captured fatal GPU error during startup check: {e}")
|
| 70 |
print("🚨 Terminating process to trigger an automatic container restart...")
|
| 71 |
print("="*80 + "\n")
|
| 72 |
os._exit(1)
|
|
|
|
| 94 |
print("--- Initiating GPU Startup Check & SageAttention Patch Verification ---")
|
| 95 |
try:
|
| 96 |
dummy_gpu_for_startup()
|
| 97 |
+
except BaseException as e:
|
| 98 |
+
err_msg = f"{type(e).__name__}: {str(e)}"
|
| 99 |
+
print(f"--- [GPU Startup] ⚠️ Warning: Startup check failed: {err_msg} ---")
|
| 100 |
+
if is_fatal_gpu_error(e):
|
| 101 |
+
print("\n" + "="*80)
|
| 102 |
+
print(f"🚨 [Fatal GPU Error] Captured fatal GPU error during startup check: {err_msg}")
|
| 103 |
+
print("🚨 Terminating process to trigger an automatic container restart...")
|
| 104 |
+
print("="*80 + "\n")
|
| 105 |
+
os._exit(1)
|
| 106 |
|
| 107 |
print("--- Starting Application Setup ---")
|
| 108 |
|
|
|
|
| 120 |
demo = build_ui(attach_event_handlers)
|
| 121 |
|
| 122 |
print("--- Launching Gradio Interface ---")
|
| 123 |
+
try:
|
| 124 |
+
demo.queue().launch(server_name="0.0.0.0", server_port=7860)
|
| 125 |
+
except ValueError as e:
|
| 126 |
+
if "localhost is not accessible" in str(e):
|
| 127 |
+
print("\n" + "="*80)
|
| 128 |
+
print(f"🚨 [Gradio Launch Error] Localhost accessibility check failed: {e}")
|
| 129 |
+
print("🚨 Terminating process to trigger an automatic container restart...")
|
| 130 |
+
print("="*80 + "\n")
|
| 131 |
+
sys.exit(1)
|
| 132 |
+
raise e
|
| 133 |
|
| 134 |
|
| 135 |
if __name__ == "__main__":
|
chain_injectors/anima_controlnet_lllite_injector.py
CHANGED
|
@@ -28,15 +28,20 @@ def inject(assembler, chain_definition, chain_items):
|
|
| 28 |
image_scaler_node['inputs']['megapixels'] = 1.0
|
| 29 |
assembler.workflow[image_scaler_id] = image_scaler_node
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
apply_cn_id = assembler._get_unique_id()
|
| 32 |
apply_cn_node = assembler._get_node_template("AnimaLLLiteApply")
|
| 33 |
|
| 34 |
-
apply_cn_node['inputs']['lllite_name'] = item_data['control_net_name']
|
| 35 |
apply_cn_node['inputs']['strength'] = item_data['strength']
|
| 36 |
apply_cn_node['inputs']['start_percent'] = item_data.get('start_percent', 0.0)
|
| 37 |
apply_cn_node['inputs']['end_percent'] = item_data.get('end_percent', 1.0)
|
| 38 |
|
| 39 |
apply_cn_node['inputs']['model'] = current_model_connection
|
|
|
|
| 40 |
apply_cn_node['inputs']['image'] = [image_scaler_id, 0]
|
| 41 |
|
| 42 |
assembler.workflow[apply_cn_id] = apply_cn_node
|
|
|
|
| 28 |
image_scaler_node['inputs']['megapixels'] = 1.0
|
| 29 |
assembler.workflow[image_scaler_id] = image_scaler_node
|
| 30 |
|
| 31 |
+
patch_loader_id = assembler._get_unique_id()
|
| 32 |
+
patch_loader_node = assembler._get_node_template("ModelPatchLoader")
|
| 33 |
+
patch_loader_node['inputs']['name'] = item_data['control_net_name']
|
| 34 |
+
assembler.workflow[patch_loader_id] = patch_loader_node
|
| 35 |
+
|
| 36 |
apply_cn_id = assembler._get_unique_id()
|
| 37 |
apply_cn_node = assembler._get_node_template("AnimaLLLiteApply")
|
| 38 |
|
|
|
|
| 39 |
apply_cn_node['inputs']['strength'] = item_data['strength']
|
| 40 |
apply_cn_node['inputs']['start_percent'] = item_data.get('start_percent', 0.0)
|
| 41 |
apply_cn_node['inputs']['end_percent'] = item_data.get('end_percent', 1.0)
|
| 42 |
|
| 43 |
apply_cn_node['inputs']['model'] = current_model_connection
|
| 44 |
+
apply_cn_node['inputs']['model_patch'] = [patch_loader_id, 0]
|
| 45 |
apply_cn_node['inputs']['image'] = [image_scaler_id, 0]
|
| 46 |
|
| 47 |
assembler.workflow[apply_cn_id] = apply_cn_node
|
comfy_integration/setup.py
CHANGED
|
@@ -80,15 +80,7 @@ def initialize_comfyui():
|
|
| 80 |
else:
|
| 81 |
print("✅ ComfyUI-Newbie-Nodes extension already exists.")
|
| 82 |
|
| 83 |
-
# 5.
|
| 84 |
-
anima_controlnet_lllite_nodes_path = os.path.join(APP_DIR, "custom_nodes", "ComfyUI-Anima-LLLite")
|
| 85 |
-
if not os.path.exists(anima_controlnet_lllite_nodes_path):
|
| 86 |
-
os.system(f"git clone https://github.com/kohya-ss/ComfyUI-Anima-LLLite.git {anima_controlnet_lllite_nodes_path}")
|
| 87 |
-
print("✅ ComfyUI-Anima-LLLite extension cloned.")
|
| 88 |
-
else:
|
| 89 |
-
print("✅ ComfyUI-Anima-LLLite extension already exists.")
|
| 90 |
-
|
| 91 |
-
# 6. comfyui-krea2-controlnet
|
| 92 |
krea2_controlnet_nodes_path = os.path.join(APP_DIR, "custom_nodes", "comfyui-krea2-controlnet")
|
| 93 |
if not os.path.exists(krea2_controlnet_nodes_path):
|
| 94 |
os.system(f"git clone https://github.com/facok/comfyui-krea2-controlnet.git {krea2_controlnet_nodes_path}")
|
|
|
|
| 80 |
else:
|
| 81 |
print("✅ ComfyUI-Newbie-Nodes extension already exists.")
|
| 82 |
|
| 83 |
+
# 5. comfyui-krea2-controlnet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
krea2_controlnet_nodes_path = os.path.join(APP_DIR, "custom_nodes", "comfyui-krea2-controlnet")
|
| 85 |
if not os.path.exists(krea2_controlnet_nodes_path):
|
| 86 |
os.system(f"git clone https://github.com/facok/comfyui-krea2-controlnet.git {krea2_controlnet_nodes_path}")
|
core/pipelines/base_pipeline.py
CHANGED
|
@@ -41,10 +41,21 @@ class BasePipeline(ABC):
|
|
| 41 |
try:
|
| 42 |
return gpu_runner(*args, **kwargs)
|
| 43 |
except BaseException as e:
|
| 44 |
-
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
print("\n" + "="*80)
|
| 47 |
-
print(f"🚨 [Fatal GPU Error] Captured
|
| 48 |
print("🚨 Terminating process to trigger an automatic container restart...")
|
| 49 |
print("="*80 + "\n")
|
| 50 |
os._exit(1)
|
|
|
|
| 41 |
try:
|
| 42 |
return gpu_runner(*args, **kwargs)
|
| 43 |
except BaseException as e:
|
| 44 |
+
err_type = type(e).__name__
|
| 45 |
+
err_str = f"{err_type}: {str(e)} | {repr(e)}".lower()
|
| 46 |
+
fatal_keywords = [
|
| 47 |
+
"ecc",
|
| 48 |
+
"uncorrectable",
|
| 49 |
+
"cudaerror",
|
| 50 |
+
"acceleratorerror",
|
| 51 |
+
"cuda error",
|
| 52 |
+
"cuda_error",
|
| 53 |
+
"device-side assertion",
|
| 54 |
+
"cuda_launch_blocking",
|
| 55 |
+
]
|
| 56 |
+
if any(kw in err_str for kw in fatal_keywords):
|
| 57 |
print("\n" + "="*80)
|
| 58 |
+
print(f"🚨 [Fatal GPU Error] Captured fatal GPU error during inference: {e}")
|
| 59 |
print("🚨 Terminating process to trigger an automatic container restart...")
|
| 60 |
print("="*80 + "\n")
|
| 61 |
os._exit(1)
|
core/pipelines/workflow_recipes/_partials/conditioning/auraflow.yaml
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
nodes:
|
| 2 |
+
ckpt_loader:
|
| 3 |
+
class_type: CheckpointLoaderSimple
|
| 4 |
+
title: "Load Checkpoint"
|
| 5 |
+
|
| 6 |
+
connections:
|
| 7 |
+
- from: "ckpt_loader:0"
|
| 8 |
+
to: "ksampler:model"
|
| 9 |
+
- from: "ckpt_loader:1"
|
| 10 |
+
to: "pos_prompt:clip"
|
| 11 |
+
- from: "ckpt_loader:1"
|
| 12 |
+
to: "neg_prompt:clip"
|
| 13 |
+
- from: "pos_prompt:0"
|
| 14 |
+
to: "ksampler:positive"
|
| 15 |
+
- from: "neg_prompt:0"
|
| 16 |
+
to: "ksampler:negative"
|
| 17 |
+
- from: "ckpt_loader:2"
|
| 18 |
+
to: "vae_decode:vae"
|
| 19 |
+
- from: "ckpt_loader:2"
|
| 20 |
+
to: "vae_encode:vae"
|
| 21 |
+
|
| 22 |
+
dynamic_vae_chains:
|
| 23 |
+
vae_chain:
|
| 24 |
+
targets:
|
| 25 |
+
- "vae_decode:vae"
|
| 26 |
+
- "vae_encode:vae"
|
| 27 |
+
|
| 28 |
+
dynamic_lora_chains:
|
| 29 |
+
lora_chain:
|
| 30 |
+
template: "LoraLoader"
|
| 31 |
+
start: "ckpt_loader"
|
| 32 |
+
output_map:
|
| 33 |
+
"0": "model"
|
| 34 |
+
"1": "clip"
|
| 35 |
+
input_map:
|
| 36 |
+
"model": "model"
|
| 37 |
+
"clip": "clip"
|
| 38 |
+
end_input_map:
|
| 39 |
+
"model": ["ksampler:model"]
|
| 40 |
+
"clip": ["pos_prompt:clip", "neg_prompt:clip"]
|
| 41 |
+
|
| 42 |
+
dynamic_conditioning_chains:
|
| 43 |
+
conditioning_chain:
|
| 44 |
+
ksampler_node: "ksampler"
|
| 45 |
+
clip_source: "ckpt_loader:1"
|
| 46 |
+
|
| 47 |
+
ui_map:
|
| 48 |
+
model_name: "ckpt_loader:ckpt_name"
|
requirements.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
comfyui-frontend-package==1.45.21
|
| 2 |
-
comfyui-workflow-templates==0.11.
|
| 3 |
comfyui-embedded-docs==0.5.8
|
| 4 |
torch
|
| 5 |
torchsde
|
|
@@ -22,7 +22,7 @@ alembic
|
|
| 22 |
SQLAlchemy>=2.0.0
|
| 23 |
filelock
|
| 24 |
av>=16.0.0
|
| 25 |
-
comfy-kitchen==0.2.
|
| 26 |
comfy-aimdo==0.4.10
|
| 27 |
requests
|
| 28 |
simpleeval>=1.0.0
|
|
|
|
| 1 |
comfyui-frontend-package==1.45.21
|
| 2 |
+
comfyui-workflow-templates==0.11.12
|
| 3 |
comfyui-embedded-docs==0.5.8
|
| 4 |
torch
|
| 5 |
torchsde
|
|
|
|
| 22 |
SQLAlchemy>=2.0.0
|
| 23 |
filelock
|
| 24 |
av>=16.0.0
|
| 25 |
+
comfy-kitchen==0.2.22
|
| 26 |
comfy-aimdo==0.4.10
|
| 27 |
requests
|
| 28 |
simpleeval>=1.0.0
|
ui/events/chain_handlers.py
CHANGED
|
@@ -46,10 +46,19 @@ def create_lora_event_handlers(prefix, ui_components):
|
|
| 46 |
lora_ids = ui_components[f'lora_ids_{prefix}']
|
| 47 |
lora_scales = ui_components[f'lora_scales_{prefix}']
|
| 48 |
lora_uploads = ui_components[f'lora_uploads_{prefix}']
|
|
|
|
| 49 |
count_state = ui_components[f'lora_count_state_{prefix}']
|
| 50 |
add_button = ui_components[f'add_lora_button_{prefix}']
|
| 51 |
del_button = ui_components[f'delete_lora_button_{prefix}']
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
def add_lora_row(c):
|
| 54 |
updates = {}
|
| 55 |
if c < MAX_LORAS:
|
|
@@ -711,10 +720,20 @@ def create_embedding_event_handlers(prefix, ui_components):
|
|
| 711 |
if not rows: return
|
| 712 |
ids = ui_components[f'embeddings_ids_{prefix}']
|
| 713 |
files = ui_components[f'embeddings_files_{prefix}']
|
|
|
|
|
|
|
| 714 |
count_state = ui_components[f'embedding_count_state_{prefix}']
|
| 715 |
add_button = ui_components[f'add_embedding_button_{prefix}']
|
| 716 |
del_button = ui_components[f'delete_embedding_button_{prefix}']
|
| 717 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 718 |
def add_row(c):
|
| 719 |
c += 1
|
| 720 |
return {
|
|
|
|
| 46 |
lora_ids = ui_components[f'lora_ids_{prefix}']
|
| 47 |
lora_scales = ui_components[f'lora_scales_{prefix}']
|
| 48 |
lora_uploads = ui_components[f'lora_uploads_{prefix}']
|
| 49 |
+
lora_sources = ui_components[f'lora_sources_{prefix}']
|
| 50 |
count_state = ui_components[f'lora_count_state_{prefix}']
|
| 51 |
add_button = ui_components[f'add_lora_button_{prefix}']
|
| 52 |
del_button = ui_components[f'delete_lora_button_{prefix}']
|
| 53 |
|
| 54 |
+
for i in range(MAX_LORAS):
|
| 55 |
+
lora_uploads[i].upload(
|
| 56 |
+
fn=on_lora_upload,
|
| 57 |
+
inputs=[lora_uploads[i]],
|
| 58 |
+
outputs=[lora_ids[i], lora_sources[i]],
|
| 59 |
+
show_progress=True
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
def add_lora_row(c):
|
| 63 |
updates = {}
|
| 64 |
if c < MAX_LORAS:
|
|
|
|
| 720 |
if not rows: return
|
| 721 |
ids = ui_components[f'embeddings_ids_{prefix}']
|
| 722 |
files = ui_components[f'embeddings_files_{prefix}']
|
| 723 |
+
sources = ui_components[f'embeddings_sources_{prefix}']
|
| 724 |
+
upload_buttons = ui_components[f'embeddings_uploads_{prefix}']
|
| 725 |
count_state = ui_components[f'embedding_count_state_{prefix}']
|
| 726 |
add_button = ui_components[f'add_embedding_button_{prefix}']
|
| 727 |
del_button = ui_components[f'delete_embedding_button_{prefix}']
|
| 728 |
|
| 729 |
+
for i in range(MAX_EMBEDDINGS):
|
| 730 |
+
upload_buttons[i].upload(
|
| 731 |
+
fn=on_embedding_upload,
|
| 732 |
+
inputs=[upload_buttons[i]],
|
| 733 |
+
outputs=[ids[i], sources[i], files[i]],
|
| 734 |
+
show_progress=True
|
| 735 |
+
)
|
| 736 |
+
|
| 737 |
def add_row(c):
|
| 738 |
c += 1
|
| 739 |
return {
|
ui/events/change_handlers.py
CHANGED
|
@@ -1,365 +1,365 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from core.settings import (
|
| 3 |
-
MODEL_TYPE_MAP,
|
| 4 |
-
MODEL_MAP_CHECKPOINT,
|
| 5 |
-
FEATURES_CONFIG,
|
| 6 |
-
ARCHITECTURES_CONFIG,
|
| 7 |
-
MODEL_DEFAULTS_CONFIG,
|
| 8 |
-
ARCH_CATEGORIES_MAP
|
| 9 |
-
)
|
| 10 |
-
from utils.app_utils import get_model_generation_defaults
|
| 11 |
-
from ui.shared.ui_components import RESOLUTION_MAP
|
| 12 |
-
from .config_loaders import (
|
| 13 |
-
get_cn_defaults,
|
| 14 |
-
get_anima_cn_defaults,
|
| 15 |
-
get_diffsynth_cn_defaults,
|
| 16 |
-
get_krea2_cn_defaults,
|
| 17 |
-
load_ipadapter_config
|
| 18 |
-
)
|
| 19 |
-
|
| 20 |
-
def make_update_fn(m_comp, cat_comp, cs_comp, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, anima_cn_types, anima_cn_series, anima_cn_filepaths, diffsynth_cn_types, diffsynth_cn_series, diffsynth_cn_filepaths, krea2_cn_types, krea2_cn_series, krea2_cn_filepaths, ipa_preset, lora_acc, cn_acc, anima_cn_acc, diffsynth_cn_acc, krea2_cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, hidream_o1_ref_acc, guidance_comp, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp, pid_acc=None, vae_acc=None):
|
| 21 |
-
def update_fn(*args):
|
| 22 |
-
arch = args[0]
|
| 23 |
-
category = args[1]
|
| 24 |
-
current_ar = args[2] if len(args) > 2 else None
|
| 25 |
-
|
| 26 |
-
if arch == "ALL":
|
| 27 |
-
valid_cats = list(set(cat for cats in ARCH_CATEGORIES_MAP.values() for cat in cats))
|
| 28 |
-
else:
|
| 29 |
-
valid_cats = ARCH_CATEGORIES_MAP.get(arch, [])
|
| 30 |
-
|
| 31 |
-
cat_choices = ["ALL"] + sorted(valid_cats)
|
| 32 |
-
new_category = category if category in cat_choices else "ALL"
|
| 33 |
-
|
| 34 |
-
choices = []
|
| 35 |
-
for name, info in MODEL_MAP_CHECKPOINT.items():
|
| 36 |
-
m_arch = info[2]
|
| 37 |
-
m_cat = info[4] if len(info) > 4 else None
|
| 38 |
-
arch_match = (arch == "ALL" or m_arch == arch)
|
| 39 |
-
cat_match = (new_category == "ALL" or m_cat == new_category)
|
| 40 |
-
if arch_match and cat_match:
|
| 41 |
-
choices.append(name)
|
| 42 |
-
|
| 43 |
-
val = choices[0] if choices else None
|
| 44 |
-
|
| 45 |
-
updates = {
|
| 46 |
-
m_comp: gr.update(choices=choices, value=val),
|
| 47 |
-
cat_comp: gr.update(choices=cat_choices, value=new_category)
|
| 48 |
-
}
|
| 49 |
-
|
| 50 |
-
m_type = MODEL_TYPE_MAP.get(val, "SDXL") if val else "SDXL"
|
| 51 |
-
|
| 52 |
-
architectures_dict = ARCHITECTURES_CONFIG.get('architectures', {})
|
| 53 |
-
arch_model_type = architectures_dict.get(m_type, {}).get("model_type", m_type.lower().replace(" ", "").replace(".", ""))
|
| 54 |
-
|
| 55 |
-
arch_features = FEATURES_CONFIG.get(arch_model_type, FEATURES_CONFIG.get('default', {}))
|
| 56 |
-
enabled_chains = arch_features.get('enabled_chains', [])
|
| 57 |
-
|
| 58 |
-
if lora_acc: updates[lora_acc] = gr.update(visible=('lora' in enabled_chains))
|
| 59 |
-
if cn_acc: updates[cn_acc] = gr.update(visible=('controlnet' in enabled_chains))
|
| 60 |
-
if anima_cn_acc: updates[anima_cn_acc] = gr.update(visible=('anima_controlnet_lllite' in enabled_chains))
|
| 61 |
-
if diffsynth_cn_acc: updates[diffsynth_cn_acc] = gr.update(visible=('controlnet_model_patch' in enabled_chains))
|
| 62 |
-
if krea2_cn_acc: updates[krea2_cn_acc] = gr.update(visible=('krea2_controlnet' in enabled_chains))
|
| 63 |
-
if ipa_acc: updates[ipa_acc] = gr.update(visible=('ipadapter' in enabled_chains))
|
| 64 |
-
if flux1_ipa_acc: updates[flux1_ipa_acc] = gr.update(visible=('flux1_ipadapter' in enabled_chains))
|
| 65 |
-
if sd3_ipa_acc: updates[sd3_ipa_acc] = gr.update(visible=('sd3_ipadapter' in enabled_chains))
|
| 66 |
-
if style_acc: updates[style_acc] = gr.update(visible=('style' in enabled_chains))
|
| 67 |
-
if embed_acc: updates[embed_acc] = gr.update(visible=('embedding' in enabled_chains))
|
| 68 |
-
if cond_acc: updates[cond_acc] = gr.update(visible=('conditioning' in enabled_chains))
|
| 69 |
-
if ref_latent_acc: updates[ref_latent_acc] = gr.update(visible=('reference_latent' in enabled_chains))
|
| 70 |
-
if hidream_o1_ref_acc: updates[hidream_o1_ref_acc] = gr.update(visible=('hidream_o1_reference' in enabled_chains))
|
| 71 |
-
if pid_acc: updates[pid_acc] = gr.update(visible=('pid' in enabled_chains))
|
| 72 |
-
if vae_acc: updates[vae_acc] = gr.update(visible=('vae' in enabled_chains))
|
| 73 |
-
|
| 74 |
-
if cs_comp:
|
| 75 |
-
updates[cs_comp] = gr.update(visible=(arch_model_type == "sd15"))
|
| 76 |
-
if guidance_comp:
|
| 77 |
-
updates[guidance_comp] = gr.update(visible=(arch_model_type == "flux1"))
|
| 78 |
-
|
| 79 |
-
if ar_comp:
|
| 80 |
-
res_key = arch_model_type
|
| 81 |
-
if res_key not in RESOLUTION_MAP:
|
| 82 |
-
res_key = 'sdxl'
|
| 83 |
-
res_map = RESOLUTION_MAP.get(res_key, {})
|
| 84 |
-
target_ar = current_ar if current_ar in res_map else (list(res_map.keys())[0] if res_map else "1:1 (Square)")
|
| 85 |
-
updates[ar_comp] = gr.update(choices=list(res_map.keys()), value=target_ar)
|
| 86 |
-
if width_comp and height_comp and target_ar in res_map:
|
| 87 |
-
updates[width_comp] = gr.update(value=res_map[target_ar][0])
|
| 88 |
-
updates[height_comp] = gr.update(value=res_map[target_ar][1])
|
| 89 |
-
|
| 90 |
-
controlnet_key = architectures_dict.get(m_type, {}).get("controlnet_key", m_type)
|
| 91 |
-
|
| 92 |
-
all_types, default_type, series_choices, default_series, filepath = get_cn_defaults(controlnet_key)
|
| 93 |
-
for t_comp in cn_types:
|
| 94 |
-
updates[t_comp] = gr.update(choices=all_types, value=default_type)
|
| 95 |
-
for s_comp in cn_series:
|
| 96 |
-
updates[s_comp] = gr.update(choices=series_choices, value=default_series)
|
| 97 |
-
for f_comp in cn_filepaths:
|
| 98 |
-
updates[f_comp] = filepath
|
| 99 |
-
|
| 100 |
-
anima_all_types, anima_default_type, anima_series_choices, anima_default_series, anima_filepath = get_anima_cn_defaults()
|
| 101 |
-
for t_comp in anima_cn_types:
|
| 102 |
-
updates[t_comp] = gr.update(choices=anima_all_types, value=anima_default_type)
|
| 103 |
-
for s_comp in anima_cn_series:
|
| 104 |
-
updates[s_comp] = gr.update(choices=anima_series_choices, value=anima_default_series)
|
| 105 |
-
for f_comp in anima_cn_filepaths:
|
| 106 |
-
updates[f_comp] = anima_filepath
|
| 107 |
-
|
| 108 |
-
diffsynth_all_types, diffsynth_default_type, diffsynth_series_choices, diffsynth_default_series, diffsynth_filepath = get_diffsynth_cn_defaults(controlnet_key)
|
| 109 |
-
for t_comp in diffsynth_cn_types:
|
| 110 |
-
updates[t_comp] = gr.update(choices=diffsynth_all_types, value=diffsynth_default_type)
|
| 111 |
-
for s_comp in diffsynth_cn_series:
|
| 112 |
-
updates[s_comp] = gr.update(choices=diffsynth_series_choices, value=diffsynth_default_series)
|
| 113 |
-
for f_comp in diffsynth_cn_filepaths:
|
| 114 |
-
updates[f_comp] = diffsynth_filepath
|
| 115 |
-
|
| 116 |
-
krea2_all_types, krea2_default_type, krea2_series_choices, krea2_default_series, krea2_filepath = get_krea2_cn_defaults()
|
| 117 |
-
for t_comp in krea2_cn_types:
|
| 118 |
-
updates[t_comp] = gr.update(choices=krea2_all_types, value=krea2_default_type)
|
| 119 |
-
for s_comp in krea2_cn_series:
|
| 120 |
-
updates[s_comp] = gr.update(choices=krea2_series_choices, value=krea2_default_series)
|
| 121 |
-
for f_comp in krea2_cn_filepaths:
|
| 122 |
-
updates[f_comp] = krea2_filepath
|
| 123 |
-
|
| 124 |
-
if ipa_preset and (arch_model_type in ["sdxl", "sd15", "sd35"]):
|
| 125 |
-
config = load_ipadapter_config()
|
| 126 |
-
ipa_arch_key = "SDXL" if arch_model_type in ["sdxl", "sd35"] else "SD1.5"
|
| 127 |
-
std_presets = config.get("IPAdapter_presets", {}).get(ipa_arch_key, [])
|
| 128 |
-
face_presets = config.get("IPAdapter_FaceID_presets", {}).get(ipa_arch_key, [])
|
| 129 |
-
all_ipa_presets = std_presets + face_presets
|
| 130 |
-
default_ipa = all_ipa_presets[0] if all_ipa_presets else None
|
| 131 |
-
updates[ipa_preset] = gr.update(choices=all_ipa_presets, value=default_ipa)
|
| 132 |
-
|
| 133 |
-
defaults = get_model_generation_defaults(val, arch_model_type, MODEL_DEFAULTS_CONFIG)
|
| 134 |
-
if steps_comp: updates[steps_comp] = gr.update(value=defaults.get('steps'))
|
| 135 |
-
if cfg_comp: updates[cfg_comp] = gr.update(value=defaults.get('cfg'))
|
| 136 |
-
if sampler_comp: updates[sampler_comp] = gr.update(value=defaults.get('sampler_name'))
|
| 137 |
-
if scheduler_comp: updates[scheduler_comp] = gr.update(value=defaults.get('scheduler'))
|
| 138 |
-
if prompt_comp: updates[prompt_comp] = gr.update(value=defaults.get('positive_prompt'))
|
| 139 |
-
if neg_prompt_comp: updates[neg_prompt_comp] = gr.update(value=defaults.get('negative_prompt'))
|
| 140 |
-
|
| 141 |
-
return updates
|
| 142 |
-
return update_fn
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
def make_model_change_fn(cat_comp_ref, cs_comp, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, anima_cn_types, anima_cn_series, anima_cn_filepaths, diffsynth_cn_types, diffsynth_cn_series, diffsynth_cn_filepaths, krea2_cn_types, krea2_cn_series, krea2_cn_filepaths, arch_comp_ref, ipa_preset, lora_acc, cn_acc, anima_cn_acc, diffsynth_cn_acc, krea2_cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, hidream_o1_ref_acc, guidance_comp, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp, pid_acc=None, vae_acc=None):
|
| 146 |
-
def change_fn(*args):
|
| 147 |
-
model_name = args[0]
|
| 148 |
-
idx = 1
|
| 149 |
-
current_arch = args[idx] if arch_comp_ref and idx < len(args) else None
|
| 150 |
-
if arch_comp_ref: idx += 1
|
| 151 |
-
current_cat = args[idx] if cat_comp_ref and idx < len(args) else None
|
| 152 |
-
if cat_comp_ref: idx += 1
|
| 153 |
-
current_ar = args[idx] if idx < len(args) else None
|
| 154 |
-
|
| 155 |
-
m_type = MODEL_TYPE_MAP.get(model_name, "SDXL")
|
| 156 |
-
|
| 157 |
-
m_info = MODEL_MAP_CHECKPOINT.get(model_name)
|
| 158 |
-
m_cat = m_info[4] if m_info and len(m_info) > 4 else None
|
| 159 |
-
if not m_cat: m_cat = "ALL"
|
| 160 |
-
|
| 161 |
-
updates = {}
|
| 162 |
-
target_arch = m_type
|
| 163 |
-
if arch_comp_ref:
|
| 164 |
-
if current_arch == "ALL":
|
| 165 |
-
updates[arch_comp_ref] = gr.update()
|
| 166 |
-
target_arch = "ALL"
|
| 167 |
-
else:
|
| 168 |
-
updates[arch_comp_ref] = m_type
|
| 169 |
-
|
| 170 |
-
if cat_comp_ref:
|
| 171 |
-
if target_arch == "ALL":
|
| 172 |
-
valid_cats = list(set(cat for cats in ARCH_CATEGORIES_MAP.values() for cat in cats))
|
| 173 |
-
else:
|
| 174 |
-
valid_cats = ARCH_CATEGORIES_MAP.get(target_arch, [])
|
| 175 |
-
cat_choices = ["ALL"] + sorted(valid_cats)
|
| 176 |
-
|
| 177 |
-
if current_cat == "ALL":
|
| 178 |
-
updates[cat_comp_ref] = gr.update(choices=cat_choices)
|
| 179 |
-
else:
|
| 180 |
-
updates[cat_comp_ref] = gr.update(choices=cat_choices, value=m_cat)
|
| 181 |
-
|
| 182 |
-
architectures_dict = ARCHITECTURES_CONFIG.get('architectures', {})
|
| 183 |
-
arch_model_type = architectures_dict.get(m_type, {}).get("model_type", m_type.lower().replace(" ", "").replace(".", ""))
|
| 184 |
-
|
| 185 |
-
arch_features = FEATURES_CONFIG.get(arch_model_type, FEATURES_CONFIG.get('default', {}))
|
| 186 |
-
enabled_chains = arch_features.get('enabled_chains', [])
|
| 187 |
-
|
| 188 |
-
if lora_acc: updates[lora_acc] = gr.update(visible=('lora' in enabled_chains))
|
| 189 |
-
if cn_acc: updates[cn_acc] = gr.update(visible=('controlnet' in enabled_chains))
|
| 190 |
-
if anima_cn_acc: updates[anima_cn_acc] = gr.update(visible=('anima_controlnet_lllite' in enabled_chains))
|
| 191 |
-
if diffsynth_cn_acc: updates[diffsynth_cn_acc] = gr.update(visible=('controlnet_model_patch' in enabled_chains))
|
| 192 |
-
if krea2_cn_acc: updates[krea2_cn_acc] = gr.update(visible=('krea2_controlnet' in enabled_chains))
|
| 193 |
-
if ipa_acc: updates[ipa_acc] = gr.update(visible=('ipadapter' in enabled_chains))
|
| 194 |
-
if flux1_ipa_acc: updates[flux1_ipa_acc] = gr.update(visible=('flux1_ipadapter' in enabled_chains))
|
| 195 |
-
if sd3_ipa_acc: updates[sd3_ipa_acc] = gr.update(visible=('sd3_ipadapter' in enabled_chains))
|
| 196 |
-
if style_acc: updates[style_acc] = gr.update(visible=('style' in enabled_chains))
|
| 197 |
-
if embed_acc: updates[embed_acc] = gr.update(visible=('embedding' in enabled_chains))
|
| 198 |
-
if cond_acc: updates[cond_acc] = gr.update(visible=('conditioning' in enabled_chains))
|
| 199 |
-
if ref_latent_acc: updates[ref_latent_acc] = gr.update(visible=('reference_latent' in enabled_chains))
|
| 200 |
-
if hidream_o1_ref_acc: updates[hidream_o1_ref_acc] = gr.update(visible=('hidream_o1_reference' in enabled_chains))
|
| 201 |
-
if pid_acc: updates[pid_acc] = gr.update(visible=('pid' in enabled_chains))
|
| 202 |
-
if vae_acc: updates[vae_acc] = gr.update(visible=('vae' in enabled_chains))
|
| 203 |
-
|
| 204 |
-
if cs_comp:
|
| 205 |
-
updates[cs_comp] = gr.update(visible=(arch_model_type == "sd15"))
|
| 206 |
-
if guidance_comp:
|
| 207 |
-
updates[guidance_comp] = gr.update(visible=(arch_model_type == "flux1"))
|
| 208 |
-
|
| 209 |
-
if ar_comp:
|
| 210 |
-
res_key = arch_model_type
|
| 211 |
-
if res_key not in RESOLUTION_MAP:
|
| 212 |
-
res_key = 'sdxl'
|
| 213 |
-
res_map = RESOLUTION_MAP.get(res_key, {})
|
| 214 |
-
target_ar = current_ar if current_ar in res_map else (list(res_map.keys())[0] if res_map else "1:1 (Square)")
|
| 215 |
-
updates[ar_comp] = gr.update(choices=list(res_map.keys()), value=target_ar)
|
| 216 |
-
if width_comp and height_comp and target_ar in res_map:
|
| 217 |
-
updates[width_comp] = gr.update(value=res_map[target_ar][0])
|
| 218 |
-
updates[height_comp] = gr.update(value=res_map[target_ar][1])
|
| 219 |
-
|
| 220 |
-
controlnet_key = architectures_dict.get(m_type, {}).get("controlnet_key", m_type)
|
| 221 |
-
|
| 222 |
-
all_types, default_type, series_choices, default_series, filepath = get_cn_defaults(controlnet_key)
|
| 223 |
-
for t_comp in cn_types:
|
| 224 |
-
updates[t_comp] = gr.update(choices=all_types, value=default_type)
|
| 225 |
-
for s_comp in cn_series:
|
| 226 |
-
updates[s_comp] = gr.update(choices=series_choices, value=default_series)
|
| 227 |
-
for f_comp in cn_filepaths:
|
| 228 |
-
updates[f_comp] = filepath
|
| 229 |
-
|
| 230 |
-
anima_all_types, anima_default_type, anima_series_choices, anima_default_series, anima_filepath = get_anima_cn_defaults()
|
| 231 |
-
for t_comp in anima_cn_types:
|
| 232 |
-
updates[t_comp] = gr.update(choices=anima_all_types, value=anima_default_type)
|
| 233 |
-
for s_comp in anima_cn_series:
|
| 234 |
-
updates[s_comp] = gr.update(choices=anima_series_choices, value=anima_default_series)
|
| 235 |
-
for f_comp in anima_cn_filepaths:
|
| 236 |
-
updates[f_comp] = anima_filepath
|
| 237 |
-
|
| 238 |
-
diffsynth_all_types, diffsynth_default_type, diffsynth_series_choices, diffsynth_default_series, diffsynth_filepath = get_diffsynth_cn_defaults(controlnet_key)
|
| 239 |
-
for t_comp in diffsynth_cn_types:
|
| 240 |
-
updates[t_comp] = gr.update(choices=diffsynth_all_types, value=diffsynth_default_type)
|
| 241 |
-
for s_comp in diffsynth_cn_series:
|
| 242 |
-
updates[s_comp] = gr.update(choices=diffsynth_series_choices, value=diffsynth_default_series)
|
| 243 |
-
for f_comp in diffsynth_cn_filepaths:
|
| 244 |
-
updates[f_comp] = diffsynth_filepath
|
| 245 |
-
|
| 246 |
-
krea2_all_types, krea2_default_type, krea2_series_choices, krea2_default_series, krea2_filepath = get_krea2_cn_defaults()
|
| 247 |
-
for t_comp in krea2_cn_types:
|
| 248 |
-
updates[t_comp] = gr.update(choices=krea2_all_types, value=krea2_default_type)
|
| 249 |
-
for s_comp in krea2_cn_series:
|
| 250 |
-
updates[s_comp] = gr.update(choices=krea2_series_choices, value=krea2_default_series)
|
| 251 |
-
for f_comp in krea2_cn_filepaths:
|
| 252 |
-
updates[f_comp] = krea2_filepath
|
| 253 |
-
|
| 254 |
-
if ipa_preset and (arch_model_type in ["sdxl", "sd15", "sd35"]):
|
| 255 |
-
config = load_ipadapter_config()
|
| 256 |
-
ipa_arch_key = "SDXL" if arch_model_type in ["sdxl", "sd35"] else "SD1.5"
|
| 257 |
-
std_presets = config.get("IPAdapter_presets", {}).get(ipa_arch_key, [])
|
| 258 |
-
face_presets = config.get("IPAdapter_FaceID_presets", {}).get(ipa_arch_key, [])
|
| 259 |
-
all_ipa_presets = std_presets + face_presets
|
| 260 |
-
default_ipa = all_ipa_presets[0] if all_ipa_presets else None
|
| 261 |
-
updates[ipa_preset] = gr.update(choices=all_ipa_presets, value=default_ipa)
|
| 262 |
-
|
| 263 |
-
defaults = get_model_generation_defaults(model_name, arch_model_type, MODEL_DEFAULTS_CONFIG)
|
| 264 |
-
if steps_comp: updates[steps_comp] = gr.update(value=defaults.get('steps'))
|
| 265 |
-
if cfg_comp: updates[cfg_comp] = gr.update(value=defaults.get('cfg'))
|
| 266 |
-
if sampler_comp: updates[sampler_comp] = gr.update(value=defaults.get('sampler_name'))
|
| 267 |
-
if scheduler_comp: updates[scheduler_comp] = gr.update(value=defaults.get('scheduler'))
|
| 268 |
-
if prompt_comp: updates[prompt_comp] = gr.update(value=defaults.get('positive_prompt'))
|
| 269 |
-
if neg_prompt_comp: updates[neg_prompt_comp] = gr.update(value=defaults.get('negative_prompt'))
|
| 270 |
-
|
| 271 |
-
return updates
|
| 272 |
-
return change_fn
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
def initialize_all_cn_dropdowns(ui_components):
|
| 276 |
-
default_model_name = list(MODEL_MAP_CHECKPOINT.keys())[0] if MODEL_MAP_CHECKPOINT else None
|
| 277 |
-
default_m_type = MODEL_TYPE_MAP.get(default_model_name, "SDXL") if default_model_name else "SDXL"
|
| 278 |
-
architectures_dict = ARCHITECTURES_CONFIG.get('architectures', {})
|
| 279 |
-
controlnet_key = architectures_dict.get(default_m_type, {}).get("controlnet_key", default_m_type)
|
| 280 |
-
|
| 281 |
-
all_types, default_type, series_choices, default_series, filepath = get_cn_defaults(controlnet_key)
|
| 282 |
-
anima_all_types, anima_default_type, anima_series_choices, anima_default_series, anima_filepath = get_anima_cn_defaults()
|
| 283 |
-
diffsynth_all_types, diffsynth_default_type, diffsynth_series_choices, diffsynth_default_series, diffsynth_filepath = get_diffsynth_cn_defaults(controlnet_key)
|
| 284 |
-
krea2_all_types, krea2_default_type, krea2_series_choices, krea2_default_series, krea2_filepath = get_krea2_cn_defaults()
|
| 285 |
-
|
| 286 |
-
updates = {}
|
| 287 |
-
for prefix in ["txt2img", "img2img", "inpaint", "outpaint", "hires_fix"]:
|
| 288 |
-
if f'controlnet_types_{prefix}' in ui_components:
|
| 289 |
-
for type_dd in ui_components[f'controlnet_types_{prefix}']:
|
| 290 |
-
updates[type_dd] = gr.update(choices=all_types, value=default_type)
|
| 291 |
-
for series_dd in ui_components[f'controlnet_series_{prefix}']:
|
| 292 |
-
updates[series_dd] = gr.update(choices=series_choices, value=default_series)
|
| 293 |
-
for filepath_state in ui_components[f'controlnet_filepaths_{prefix}']:
|
| 294 |
-
updates[filepath_state] = filepath
|
| 295 |
-
|
| 296 |
-
if f'anima_controlnet_lllite_types_{prefix}' in ui_components:
|
| 297 |
-
for type_dd in ui_components[f'anima_controlnet_lllite_types_{prefix}']:
|
| 298 |
-
updates[type_dd] = gr.update(choices=anima_all_types, value=anima_default_type)
|
| 299 |
-
for series_dd in ui_components[f'anima_controlnet_lllite_series_{prefix}']:
|
| 300 |
-
updates[series_dd] = gr.update(choices=anima_series_choices, value=anima_default_series)
|
| 301 |
-
for filepath_state in ui_components[f'anima_controlnet_lllite_filepaths_{prefix}']:
|
| 302 |
-
updates[filepath_state] = anima_filepath
|
| 303 |
-
|
| 304 |
-
if f'diffsynth_controlnet_types_{prefix}' in ui_components:
|
| 305 |
-
for type_dd in ui_components[f'diffsynth_controlnet_types_{prefix}']:
|
| 306 |
-
updates[type_dd] = gr.update(choices=diffsynth_all_types, value=diffsynth_default_type)
|
| 307 |
-
for series_dd in ui_components[f'diffsynth_controlnet_series_{prefix}']:
|
| 308 |
-
updates[series_dd] = gr.update(choices=diffsynth_series_choices, value=default_series)
|
| 309 |
-
for filepath_state in ui_components[f'diffsynth_controlnet_filepaths_{prefix}']:
|
| 310 |
-
updates[filepath_state] = diffsynth_filepath
|
| 311 |
-
|
| 312 |
-
if f'krea2_controlnet_types_{prefix}' in ui_components:
|
| 313 |
-
for type_dd in ui_components[f'krea2_controlnet_types_{prefix}']:
|
| 314 |
-
updates[type_dd] = gr.update(choices=krea2_all_types, value=krea2_default_type)
|
| 315 |
-
for series_dd in ui_components[f'krea2_controlnet_series_{prefix}']:
|
| 316 |
-
updates[series_dd] = gr.update(choices=krea2_series_choices, value=krea2_default_series)
|
| 317 |
-
for filepath_state in ui_components[f'krea2_controlnet_filepaths_{prefix}']:
|
| 318 |
-
updates[filepath_state] = krea2_filepath
|
| 319 |
-
|
| 320 |
-
return updates
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
def initialize_all_ipa_dropdowns(ui_components):
|
| 324 |
-
config = load_ipadapter_config()
|
| 325 |
-
if not config: return {}
|
| 326 |
-
|
| 327 |
-
default_model_name = list(MODEL_MAP_CHECKPOINT.keys())[0] if MODEL_MAP_CHECKPOINT else None
|
| 328 |
-
default_m_type = MODEL_TYPE_MAP.get(default_model_name, "SDXL") if default_model_name else "SDXL"
|
| 329 |
-
architectures_dict = ARCHITECTURES_CONFIG.get('architectures', {})
|
| 330 |
-
arch_model_type = architectures_dict.get(default_m_type, {}).get("model_type", default_m_type.lower().replace(" ", "").replace(".", ""))
|
| 331 |
-
ipa_arch_key = "SDXL" if arch_model_type in ["sdxl", "sd35"] else "SD1.5"
|
| 332 |
-
|
| 333 |
-
unified_presets = config.get("IPAdapter_presets", {}).get(ipa_arch_key, [])
|
| 334 |
-
faceid_presets = config.get("IPAdapter_FaceID_presets", {}).get(ipa_arch_key, [])
|
| 335 |
-
|
| 336 |
-
all_presets = unified_presets + faceid_presets
|
| 337 |
-
default_preset = all_presets[0] if all_presets else None
|
| 338 |
-
is_faceid_default = default_preset in faceid_presets
|
| 339 |
-
|
| 340 |
-
lora_strength_update = gr.update(visible=is_faceid_default)
|
| 341 |
-
|
| 342 |
-
updates = {}
|
| 343 |
-
for prefix in ["txt2img", "img2img", "inpaint", "outpaint", "hires_fix"]:
|
| 344 |
-
if f'ipadapter_final_preset_{prefix}' in ui_components:
|
| 345 |
-
for lora_strength_slider in ui_components[f'ipadapter_lora_strengths_{prefix}']:
|
| 346 |
-
updates[lora_strength_slider] = lora_strength_update
|
| 347 |
-
updates[ui_components[f'ipadapter_final_preset_{prefix}']] = gr.update(choices=all_presets, value=default_preset)
|
| 348 |
-
updates[ui_components[f'ipadapter_final_lora_strength_{prefix}']] = lora_strength_update
|
| 349 |
-
return updates
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
def run_on_load(ui_components):
|
| 353 |
-
cn_updates = initialize_all_cn_dropdowns(ui_components)
|
| 354 |
-
ipa_updates = initialize_all_ipa_dropdowns(ui_components)
|
| 355 |
-
return {**cn_updates, **ipa_updates}
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
def on_aspect_ratio_change(ratio_key, model_display_name):
|
| 359 |
-
m_type = MODEL_TYPE_MAP.get(model_display_name, 'SDXL')
|
| 360 |
-
architectures_dict = ARCHITECTURES_CONFIG.get('architectures', {})
|
| 361 |
-
arch_model_type = architectures_dict.get(m_type, {}).get("model_type", m_type.lower().replace(" ", "").replace(".", ""))
|
| 362 |
-
|
| 363 |
-
res_map = RESOLUTION_MAP.get(arch_model_type, RESOLUTION_MAP.get("sdxl", {}))
|
| 364 |
-
w, h = res_map.get(ratio_key, (1024, 1024))
|
| 365 |
return w, h
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from core.settings import (
|
| 3 |
+
MODEL_TYPE_MAP,
|
| 4 |
+
MODEL_MAP_CHECKPOINT,
|
| 5 |
+
FEATURES_CONFIG,
|
| 6 |
+
ARCHITECTURES_CONFIG,
|
| 7 |
+
MODEL_DEFAULTS_CONFIG,
|
| 8 |
+
ARCH_CATEGORIES_MAP
|
| 9 |
+
)
|
| 10 |
+
from utils.app_utils import get_model_generation_defaults
|
| 11 |
+
from ui.shared.ui_components import RESOLUTION_MAP
|
| 12 |
+
from .config_loaders import (
|
| 13 |
+
get_cn_defaults,
|
| 14 |
+
get_anima_cn_defaults,
|
| 15 |
+
get_diffsynth_cn_defaults,
|
| 16 |
+
get_krea2_cn_defaults,
|
| 17 |
+
load_ipadapter_config
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
def make_update_fn(m_comp, cat_comp, cs_comp, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, anima_cn_types, anima_cn_series, anima_cn_filepaths, diffsynth_cn_types, diffsynth_cn_series, diffsynth_cn_filepaths, krea2_cn_types, krea2_cn_series, krea2_cn_filepaths, ipa_preset, lora_acc, cn_acc, anima_cn_acc, diffsynth_cn_acc, krea2_cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, hidream_o1_ref_acc, guidance_comp, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp, pid_acc=None, vae_acc=None):
|
| 21 |
+
def update_fn(*args):
|
| 22 |
+
arch = args[0]
|
| 23 |
+
category = args[1]
|
| 24 |
+
current_ar = args[2] if len(args) > 2 else None
|
| 25 |
+
|
| 26 |
+
if arch == "ALL":
|
| 27 |
+
valid_cats = list(set(cat for cats in ARCH_CATEGORIES_MAP.values() for cat in cats))
|
| 28 |
+
else:
|
| 29 |
+
valid_cats = ARCH_CATEGORIES_MAP.get(arch, [])
|
| 30 |
+
|
| 31 |
+
cat_choices = ["ALL"] + sorted(valid_cats)
|
| 32 |
+
new_category = category if category in cat_choices else "ALL"
|
| 33 |
+
|
| 34 |
+
choices = []
|
| 35 |
+
for name, info in MODEL_MAP_CHECKPOINT.items():
|
| 36 |
+
m_arch = info[2]
|
| 37 |
+
m_cat = info[4] if len(info) > 4 else None
|
| 38 |
+
arch_match = (arch == "ALL" or m_arch == arch)
|
| 39 |
+
cat_match = (new_category == "ALL" or m_cat == new_category)
|
| 40 |
+
if arch_match and cat_match:
|
| 41 |
+
choices.append(name)
|
| 42 |
+
|
| 43 |
+
val = choices[0] if choices else None
|
| 44 |
+
|
| 45 |
+
updates = {
|
| 46 |
+
m_comp: gr.update(choices=choices, value=val),
|
| 47 |
+
cat_comp: gr.update(choices=cat_choices, value=new_category)
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
m_type = MODEL_TYPE_MAP.get(val, "SDXL") if val else "SDXL"
|
| 51 |
+
|
| 52 |
+
architectures_dict = ARCHITECTURES_CONFIG.get('architectures', {})
|
| 53 |
+
arch_model_type = architectures_dict.get(m_type, {}).get("model_type", m_type.lower().replace(" ", "").replace(".", ""))
|
| 54 |
+
|
| 55 |
+
arch_features = FEATURES_CONFIG.get(arch_model_type, FEATURES_CONFIG.get('default', {}))
|
| 56 |
+
enabled_chains = arch_features.get('enabled_chains', [])
|
| 57 |
+
|
| 58 |
+
if lora_acc: updates[lora_acc] = gr.update(visible=('lora' in enabled_chains))
|
| 59 |
+
if cn_acc: updates[cn_acc] = gr.update(visible=('controlnet' in enabled_chains))
|
| 60 |
+
if anima_cn_acc: updates[anima_cn_acc] = gr.update(visible=('anima_controlnet_lllite' in enabled_chains))
|
| 61 |
+
if diffsynth_cn_acc: updates[diffsynth_cn_acc] = gr.update(visible=('controlnet_model_patch' in enabled_chains))
|
| 62 |
+
if krea2_cn_acc: updates[krea2_cn_acc] = gr.update(visible=('krea2_controlnet' in enabled_chains))
|
| 63 |
+
if ipa_acc: updates[ipa_acc] = gr.update(visible=('ipadapter' in enabled_chains))
|
| 64 |
+
if flux1_ipa_acc: updates[flux1_ipa_acc] = gr.update(visible=('flux1_ipadapter' in enabled_chains))
|
| 65 |
+
if sd3_ipa_acc: updates[sd3_ipa_acc] = gr.update(visible=('sd3_ipadapter' in enabled_chains))
|
| 66 |
+
if style_acc: updates[style_acc] = gr.update(visible=('style' in enabled_chains))
|
| 67 |
+
if embed_acc: updates[embed_acc] = gr.update(visible=('embedding' in enabled_chains))
|
| 68 |
+
if cond_acc: updates[cond_acc] = gr.update(visible=('conditioning' in enabled_chains))
|
| 69 |
+
if ref_latent_acc: updates[ref_latent_acc] = gr.update(visible=('reference_latent' in enabled_chains))
|
| 70 |
+
if hidream_o1_ref_acc: updates[hidream_o1_ref_acc] = gr.update(visible=('hidream_o1_reference' in enabled_chains))
|
| 71 |
+
if pid_acc: updates[pid_acc] = gr.update(visible=('pid' in enabled_chains))
|
| 72 |
+
if vae_acc: updates[vae_acc] = gr.update(visible=('vae' in enabled_chains))
|
| 73 |
+
|
| 74 |
+
if cs_comp:
|
| 75 |
+
updates[cs_comp] = gr.update(visible=(arch_model_type == "sd15"))
|
| 76 |
+
if guidance_comp:
|
| 77 |
+
updates[guidance_comp] = gr.update(visible=(arch_model_type == "flux1"))
|
| 78 |
+
|
| 79 |
+
if ar_comp:
|
| 80 |
+
res_key = arch_model_type
|
| 81 |
+
if res_key not in RESOLUTION_MAP:
|
| 82 |
+
res_key = 'sdxl'
|
| 83 |
+
res_map = RESOLUTION_MAP.get(res_key, {})
|
| 84 |
+
target_ar = current_ar if current_ar in res_map else (list(res_map.keys())[0] if res_map else "1:1 (Square)")
|
| 85 |
+
updates[ar_comp] = gr.update(choices=list(res_map.keys()), value=target_ar)
|
| 86 |
+
if width_comp and height_comp and target_ar in res_map:
|
| 87 |
+
updates[width_comp] = gr.update(value=res_map[target_ar][0])
|
| 88 |
+
updates[height_comp] = gr.update(value=res_map[target_ar][1])
|
| 89 |
+
|
| 90 |
+
controlnet_key = architectures_dict.get(m_type, {}).get("controlnet_key", m_type)
|
| 91 |
+
|
| 92 |
+
all_types, default_type, series_choices, default_series, filepath = get_cn_defaults(controlnet_key)
|
| 93 |
+
for t_comp in cn_types:
|
| 94 |
+
updates[t_comp] = gr.update(choices=all_types, value=default_type)
|
| 95 |
+
for s_comp in cn_series:
|
| 96 |
+
updates[s_comp] = gr.update(choices=series_choices, value=default_series)
|
| 97 |
+
for f_comp in cn_filepaths:
|
| 98 |
+
updates[f_comp] = filepath
|
| 99 |
+
|
| 100 |
+
anima_all_types, anima_default_type, anima_series_choices, anima_default_series, anima_filepath = get_anima_cn_defaults()
|
| 101 |
+
for t_comp in anima_cn_types:
|
| 102 |
+
updates[t_comp] = gr.update(choices=anima_all_types, value=anima_default_type)
|
| 103 |
+
for s_comp in anima_cn_series:
|
| 104 |
+
updates[s_comp] = gr.update(choices=anima_series_choices, value=anima_default_series)
|
| 105 |
+
for f_comp in anima_cn_filepaths:
|
| 106 |
+
updates[f_comp] = anima_filepath
|
| 107 |
+
|
| 108 |
+
diffsynth_all_types, diffsynth_default_type, diffsynth_series_choices, diffsynth_default_series, diffsynth_filepath = get_diffsynth_cn_defaults(controlnet_key)
|
| 109 |
+
for t_comp in diffsynth_cn_types:
|
| 110 |
+
updates[t_comp] = gr.update(choices=diffsynth_all_types, value=diffsynth_default_type)
|
| 111 |
+
for s_comp in diffsynth_cn_series:
|
| 112 |
+
updates[s_comp] = gr.update(choices=diffsynth_series_choices, value=diffsynth_default_series)
|
| 113 |
+
for f_comp in diffsynth_cn_filepaths:
|
| 114 |
+
updates[f_comp] = diffsynth_filepath
|
| 115 |
+
|
| 116 |
+
krea2_all_types, krea2_default_type, krea2_series_choices, krea2_default_series, krea2_filepath = get_krea2_cn_defaults()
|
| 117 |
+
for t_comp in krea2_cn_types:
|
| 118 |
+
updates[t_comp] = gr.update(choices=krea2_all_types, value=krea2_default_type)
|
| 119 |
+
for s_comp in krea2_cn_series:
|
| 120 |
+
updates[s_comp] = gr.update(choices=krea2_series_choices, value=krea2_default_series)
|
| 121 |
+
for f_comp in krea2_cn_filepaths:
|
| 122 |
+
updates[f_comp] = krea2_filepath
|
| 123 |
+
|
| 124 |
+
if ipa_preset and (arch_model_type in ["sdxl", "sd15", "sd35"]):
|
| 125 |
+
config = load_ipadapter_config()
|
| 126 |
+
ipa_arch_key = "SDXL" if arch_model_type in ["sdxl", "sd35"] else "SD1.5"
|
| 127 |
+
std_presets = config.get("IPAdapter_presets", {}).get(ipa_arch_key, [])
|
| 128 |
+
face_presets = config.get("IPAdapter_FaceID_presets", {}).get(ipa_arch_key, [])
|
| 129 |
+
all_ipa_presets = std_presets + face_presets
|
| 130 |
+
default_ipa = all_ipa_presets[0] if all_ipa_presets else None
|
| 131 |
+
updates[ipa_preset] = gr.update(choices=all_ipa_presets, value=default_ipa)
|
| 132 |
+
|
| 133 |
+
defaults = get_model_generation_defaults(val, arch_model_type, MODEL_DEFAULTS_CONFIG)
|
| 134 |
+
if steps_comp: updates[steps_comp] = gr.update(value=defaults.get('steps'))
|
| 135 |
+
if cfg_comp: updates[cfg_comp] = gr.update(value=defaults.get('cfg'))
|
| 136 |
+
if sampler_comp: updates[sampler_comp] = gr.update(value=defaults.get('sampler_name'))
|
| 137 |
+
if scheduler_comp: updates[scheduler_comp] = gr.update(value=defaults.get('scheduler'))
|
| 138 |
+
if prompt_comp: updates[prompt_comp] = gr.update(value=defaults.get('positive_prompt'))
|
| 139 |
+
if neg_prompt_comp: updates[neg_prompt_comp] = gr.update(value=defaults.get('negative_prompt'))
|
| 140 |
+
|
| 141 |
+
return updates
|
| 142 |
+
return update_fn
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
def make_model_change_fn(cat_comp_ref, cs_comp, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, anima_cn_types, anima_cn_series, anima_cn_filepaths, diffsynth_cn_types, diffsynth_cn_series, diffsynth_cn_filepaths, krea2_cn_types, krea2_cn_series, krea2_cn_filepaths, arch_comp_ref, ipa_preset, lora_acc, cn_acc, anima_cn_acc, diffsynth_cn_acc, krea2_cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, hidream_o1_ref_acc, guidance_comp, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp, pid_acc=None, vae_acc=None):
|
| 146 |
+
def change_fn(*args):
|
| 147 |
+
model_name = args[0]
|
| 148 |
+
idx = 1
|
| 149 |
+
current_arch = args[idx] if arch_comp_ref and idx < len(args) else None
|
| 150 |
+
if arch_comp_ref: idx += 1
|
| 151 |
+
current_cat = args[idx] if cat_comp_ref and idx < len(args) else None
|
| 152 |
+
if cat_comp_ref: idx += 1
|
| 153 |
+
current_ar = args[idx] if idx < len(args) else None
|
| 154 |
+
|
| 155 |
+
m_type = MODEL_TYPE_MAP.get(model_name, "SDXL")
|
| 156 |
+
|
| 157 |
+
m_info = MODEL_MAP_CHECKPOINT.get(model_name)
|
| 158 |
+
m_cat = m_info[4] if m_info and len(m_info) > 4 else None
|
| 159 |
+
if not m_cat: m_cat = "ALL"
|
| 160 |
+
|
| 161 |
+
updates = {}
|
| 162 |
+
target_arch = m_type
|
| 163 |
+
if arch_comp_ref:
|
| 164 |
+
if current_arch == "ALL":
|
| 165 |
+
updates[arch_comp_ref] = gr.update()
|
| 166 |
+
target_arch = "ALL"
|
| 167 |
+
else:
|
| 168 |
+
updates[arch_comp_ref] = m_type
|
| 169 |
+
|
| 170 |
+
if cat_comp_ref:
|
| 171 |
+
if target_arch == "ALL":
|
| 172 |
+
valid_cats = list(set(cat for cats in ARCH_CATEGORIES_MAP.values() for cat in cats))
|
| 173 |
+
else:
|
| 174 |
+
valid_cats = ARCH_CATEGORIES_MAP.get(target_arch, [])
|
| 175 |
+
cat_choices = ["ALL"] + sorted(valid_cats)
|
| 176 |
+
|
| 177 |
+
if current_cat == "ALL":
|
| 178 |
+
updates[cat_comp_ref] = gr.update(choices=cat_choices)
|
| 179 |
+
else:
|
| 180 |
+
updates[cat_comp_ref] = gr.update(choices=cat_choices, value=m_cat)
|
| 181 |
+
|
| 182 |
+
architectures_dict = ARCHITECTURES_CONFIG.get('architectures', {})
|
| 183 |
+
arch_model_type = architectures_dict.get(m_type, {}).get("model_type", m_type.lower().replace(" ", "").replace(".", ""))
|
| 184 |
+
|
| 185 |
+
arch_features = FEATURES_CONFIG.get(arch_model_type, FEATURES_CONFIG.get('default', {}))
|
| 186 |
+
enabled_chains = arch_features.get('enabled_chains', [])
|
| 187 |
+
|
| 188 |
+
if lora_acc: updates[lora_acc] = gr.update(visible=('lora' in enabled_chains))
|
| 189 |
+
if cn_acc: updates[cn_acc] = gr.update(visible=('controlnet' in enabled_chains))
|
| 190 |
+
if anima_cn_acc: updates[anima_cn_acc] = gr.update(visible=('anima_controlnet_lllite' in enabled_chains))
|
| 191 |
+
if diffsynth_cn_acc: updates[diffsynth_cn_acc] = gr.update(visible=('controlnet_model_patch' in enabled_chains))
|
| 192 |
+
if krea2_cn_acc: updates[krea2_cn_acc] = gr.update(visible=('krea2_controlnet' in enabled_chains))
|
| 193 |
+
if ipa_acc: updates[ipa_acc] = gr.update(visible=('ipadapter' in enabled_chains))
|
| 194 |
+
if flux1_ipa_acc: updates[flux1_ipa_acc] = gr.update(visible=('flux1_ipadapter' in enabled_chains))
|
| 195 |
+
if sd3_ipa_acc: updates[sd3_ipa_acc] = gr.update(visible=('sd3_ipadapter' in enabled_chains))
|
| 196 |
+
if style_acc: updates[style_acc] = gr.update(visible=('style' in enabled_chains))
|
| 197 |
+
if embed_acc: updates[embed_acc] = gr.update(visible=('embedding' in enabled_chains))
|
| 198 |
+
if cond_acc: updates[cond_acc] = gr.update(visible=('conditioning' in enabled_chains))
|
| 199 |
+
if ref_latent_acc: updates[ref_latent_acc] = gr.update(visible=('reference_latent' in enabled_chains))
|
| 200 |
+
if hidream_o1_ref_acc: updates[hidream_o1_ref_acc] = gr.update(visible=('hidream_o1_reference' in enabled_chains))
|
| 201 |
+
if pid_acc: updates[pid_acc] = gr.update(visible=('pid' in enabled_chains))
|
| 202 |
+
if vae_acc: updates[vae_acc] = gr.update(visible=('vae' in enabled_chains))
|
| 203 |
+
|
| 204 |
+
if cs_comp:
|
| 205 |
+
updates[cs_comp] = gr.update(visible=(arch_model_type == "sd15"))
|
| 206 |
+
if guidance_comp:
|
| 207 |
+
updates[guidance_comp] = gr.update(visible=(arch_model_type == "flux1"))
|
| 208 |
+
|
| 209 |
+
if ar_comp:
|
| 210 |
+
res_key = arch_model_type
|
| 211 |
+
if res_key not in RESOLUTION_MAP:
|
| 212 |
+
res_key = 'sdxl'
|
| 213 |
+
res_map = RESOLUTION_MAP.get(res_key, {})
|
| 214 |
+
target_ar = current_ar if current_ar in res_map else (list(res_map.keys())[0] if res_map else "1:1 (Square)")
|
| 215 |
+
updates[ar_comp] = gr.update(choices=list(res_map.keys()), value=target_ar)
|
| 216 |
+
if width_comp and height_comp and target_ar in res_map:
|
| 217 |
+
updates[width_comp] = gr.update(value=res_map[target_ar][0])
|
| 218 |
+
updates[height_comp] = gr.update(value=res_map[target_ar][1])
|
| 219 |
+
|
| 220 |
+
controlnet_key = architectures_dict.get(m_type, {}).get("controlnet_key", m_type)
|
| 221 |
+
|
| 222 |
+
all_types, default_type, series_choices, default_series, filepath = get_cn_defaults(controlnet_key)
|
| 223 |
+
for t_comp in cn_types:
|
| 224 |
+
updates[t_comp] = gr.update(choices=all_types, value=default_type)
|
| 225 |
+
for s_comp in cn_series:
|
| 226 |
+
updates[s_comp] = gr.update(choices=series_choices, value=default_series)
|
| 227 |
+
for f_comp in cn_filepaths:
|
| 228 |
+
updates[f_comp] = filepath
|
| 229 |
+
|
| 230 |
+
anima_all_types, anima_default_type, anima_series_choices, anima_default_series, anima_filepath = get_anima_cn_defaults()
|
| 231 |
+
for t_comp in anima_cn_types:
|
| 232 |
+
updates[t_comp] = gr.update(choices=anima_all_types, value=anima_default_type)
|
| 233 |
+
for s_comp in anima_cn_series:
|
| 234 |
+
updates[s_comp] = gr.update(choices=anima_series_choices, value=anima_default_series)
|
| 235 |
+
for f_comp in anima_cn_filepaths:
|
| 236 |
+
updates[f_comp] = anima_filepath
|
| 237 |
+
|
| 238 |
+
diffsynth_all_types, diffsynth_default_type, diffsynth_series_choices, diffsynth_default_series, diffsynth_filepath = get_diffsynth_cn_defaults(controlnet_key)
|
| 239 |
+
for t_comp in diffsynth_cn_types:
|
| 240 |
+
updates[t_comp] = gr.update(choices=diffsynth_all_types, value=diffsynth_default_type)
|
| 241 |
+
for s_comp in diffsynth_cn_series:
|
| 242 |
+
updates[s_comp] = gr.update(choices=diffsynth_series_choices, value=diffsynth_default_series)
|
| 243 |
+
for f_comp in diffsynth_cn_filepaths:
|
| 244 |
+
updates[f_comp] = diffsynth_filepath
|
| 245 |
+
|
| 246 |
+
krea2_all_types, krea2_default_type, krea2_series_choices, krea2_default_series, krea2_filepath = get_krea2_cn_defaults()
|
| 247 |
+
for t_comp in krea2_cn_types:
|
| 248 |
+
updates[t_comp] = gr.update(choices=krea2_all_types, value=krea2_default_type)
|
| 249 |
+
for s_comp in krea2_cn_series:
|
| 250 |
+
updates[s_comp] = gr.update(choices=krea2_series_choices, value=krea2_default_series)
|
| 251 |
+
for f_comp in krea2_cn_filepaths:
|
| 252 |
+
updates[f_comp] = krea2_filepath
|
| 253 |
+
|
| 254 |
+
if ipa_preset and (arch_model_type in ["sdxl", "sd15", "sd35"]):
|
| 255 |
+
config = load_ipadapter_config()
|
| 256 |
+
ipa_arch_key = "SDXL" if arch_model_type in ["sdxl", "sd35"] else "SD1.5"
|
| 257 |
+
std_presets = config.get("IPAdapter_presets", {}).get(ipa_arch_key, [])
|
| 258 |
+
face_presets = config.get("IPAdapter_FaceID_presets", {}).get(ipa_arch_key, [])
|
| 259 |
+
all_ipa_presets = std_presets + face_presets
|
| 260 |
+
default_ipa = all_ipa_presets[0] if all_ipa_presets else None
|
| 261 |
+
updates[ipa_preset] = gr.update(choices=all_ipa_presets, value=default_ipa)
|
| 262 |
+
|
| 263 |
+
defaults = get_model_generation_defaults(model_name, arch_model_type, MODEL_DEFAULTS_CONFIG)
|
| 264 |
+
if steps_comp: updates[steps_comp] = gr.update(value=defaults.get('steps'))
|
| 265 |
+
if cfg_comp: updates[cfg_comp] = gr.update(value=defaults.get('cfg'))
|
| 266 |
+
if sampler_comp: updates[sampler_comp] = gr.update(value=defaults.get('sampler_name'))
|
| 267 |
+
if scheduler_comp: updates[scheduler_comp] = gr.update(value=defaults.get('scheduler'))
|
| 268 |
+
if prompt_comp: updates[prompt_comp] = gr.update(value=defaults.get('positive_prompt'))
|
| 269 |
+
if neg_prompt_comp: updates[neg_prompt_comp] = gr.update(value=defaults.get('negative_prompt'))
|
| 270 |
+
|
| 271 |
+
return updates
|
| 272 |
+
return change_fn
|
| 273 |
+
|
| 274 |
+
|
| 275 |
+
def initialize_all_cn_dropdowns(ui_components):
|
| 276 |
+
default_model_name = list(MODEL_MAP_CHECKPOINT.keys())[0] if MODEL_MAP_CHECKPOINT else None
|
| 277 |
+
default_m_type = MODEL_TYPE_MAP.get(default_model_name, "SDXL") if default_model_name else "SDXL"
|
| 278 |
+
architectures_dict = ARCHITECTURES_CONFIG.get('architectures', {})
|
| 279 |
+
controlnet_key = architectures_dict.get(default_m_type, {}).get("controlnet_key", default_m_type)
|
| 280 |
+
|
| 281 |
+
all_types, default_type, series_choices, default_series, filepath = get_cn_defaults(controlnet_key)
|
| 282 |
+
anima_all_types, anima_default_type, anima_series_choices, anima_default_series, anima_filepath = get_anima_cn_defaults()
|
| 283 |
+
diffsynth_all_types, diffsynth_default_type, diffsynth_series_choices, diffsynth_default_series, diffsynth_filepath = get_diffsynth_cn_defaults(controlnet_key)
|
| 284 |
+
krea2_all_types, krea2_default_type, krea2_series_choices, krea2_default_series, krea2_filepath = get_krea2_cn_defaults()
|
| 285 |
+
|
| 286 |
+
updates = {}
|
| 287 |
+
for prefix in ["txt2img", "img2img", "inpaint", "outpaint", "hires_fix"]:
|
| 288 |
+
if f'controlnet_types_{prefix}' in ui_components:
|
| 289 |
+
for type_dd in ui_components[f'controlnet_types_{prefix}']:
|
| 290 |
+
updates[type_dd] = gr.update(choices=all_types, value=default_type)
|
| 291 |
+
for series_dd in ui_components[f'controlnet_series_{prefix}']:
|
| 292 |
+
updates[series_dd] = gr.update(choices=series_choices, value=default_series)
|
| 293 |
+
for filepath_state in ui_components[f'controlnet_filepaths_{prefix}']:
|
| 294 |
+
updates[filepath_state] = filepath
|
| 295 |
+
|
| 296 |
+
if f'anima_controlnet_lllite_types_{prefix}' in ui_components:
|
| 297 |
+
for type_dd in ui_components[f'anima_controlnet_lllite_types_{prefix}']:
|
| 298 |
+
updates[type_dd] = gr.update(choices=anima_all_types, value=anima_default_type)
|
| 299 |
+
for series_dd in ui_components[f'anima_controlnet_lllite_series_{prefix}']:
|
| 300 |
+
updates[series_dd] = gr.update(choices=anima_series_choices, value=anima_default_series)
|
| 301 |
+
for filepath_state in ui_components[f'anima_controlnet_lllite_filepaths_{prefix}']:
|
| 302 |
+
updates[filepath_state] = anima_filepath
|
| 303 |
+
|
| 304 |
+
if f'diffsynth_controlnet_types_{prefix}' in ui_components:
|
| 305 |
+
for type_dd in ui_components[f'diffsynth_controlnet_types_{prefix}']:
|
| 306 |
+
updates[type_dd] = gr.update(choices=diffsynth_all_types, value=diffsynth_default_type)
|
| 307 |
+
for series_dd in ui_components[f'diffsynth_controlnet_series_{prefix}']:
|
| 308 |
+
updates[series_dd] = gr.update(choices=diffsynth_series_choices, value=default_series)
|
| 309 |
+
for filepath_state in ui_components[f'diffsynth_controlnet_filepaths_{prefix}']:
|
| 310 |
+
updates[filepath_state] = diffsynth_filepath
|
| 311 |
+
|
| 312 |
+
if f'krea2_controlnet_types_{prefix}' in ui_components:
|
| 313 |
+
for type_dd in ui_components[f'krea2_controlnet_types_{prefix}']:
|
| 314 |
+
updates[type_dd] = gr.update(choices=krea2_all_types, value=krea2_default_type)
|
| 315 |
+
for series_dd in ui_components[f'krea2_controlnet_series_{prefix}']:
|
| 316 |
+
updates[series_dd] = gr.update(choices=krea2_series_choices, value=krea2_default_series)
|
| 317 |
+
for filepath_state in ui_components[f'krea2_controlnet_filepaths_{prefix}']:
|
| 318 |
+
updates[filepath_state] = krea2_filepath
|
| 319 |
+
|
| 320 |
+
return updates
|
| 321 |
+
|
| 322 |
+
|
| 323 |
+
def initialize_all_ipa_dropdowns(ui_components):
|
| 324 |
+
config = load_ipadapter_config()
|
| 325 |
+
if not config: return {}
|
| 326 |
+
|
| 327 |
+
default_model_name = list(MODEL_MAP_CHECKPOINT.keys())[0] if MODEL_MAP_CHECKPOINT else None
|
| 328 |
+
default_m_type = MODEL_TYPE_MAP.get(default_model_name, "SDXL") if default_model_name else "SDXL"
|
| 329 |
+
architectures_dict = ARCHITECTURES_CONFIG.get('architectures', {})
|
| 330 |
+
arch_model_type = architectures_dict.get(default_m_type, {}).get("model_type", default_m_type.lower().replace(" ", "").replace(".", ""))
|
| 331 |
+
ipa_arch_key = "SDXL" if arch_model_type in ["sdxl", "sd35"] else "SD1.5"
|
| 332 |
+
|
| 333 |
+
unified_presets = config.get("IPAdapter_presets", {}).get(ipa_arch_key, [])
|
| 334 |
+
faceid_presets = config.get("IPAdapter_FaceID_presets", {}).get(ipa_arch_key, [])
|
| 335 |
+
|
| 336 |
+
all_presets = unified_presets + faceid_presets
|
| 337 |
+
default_preset = all_presets[0] if all_presets else None
|
| 338 |
+
is_faceid_default = default_preset in faceid_presets
|
| 339 |
+
|
| 340 |
+
lora_strength_update = gr.update(visible=is_faceid_default)
|
| 341 |
+
|
| 342 |
+
updates = {}
|
| 343 |
+
for prefix in ["txt2img", "img2img", "inpaint", "outpaint", "hires_fix"]:
|
| 344 |
+
if f'ipadapter_final_preset_{prefix}' in ui_components:
|
| 345 |
+
for lora_strength_slider in ui_components[f'ipadapter_lora_strengths_{prefix}']:
|
| 346 |
+
updates[lora_strength_slider] = lora_strength_update
|
| 347 |
+
updates[ui_components[f'ipadapter_final_preset_{prefix}']] = gr.update(choices=all_presets, value=default_preset)
|
| 348 |
+
updates[ui_components[f'ipadapter_final_lora_strength_{prefix}']] = lora_strength_update
|
| 349 |
+
return updates
|
| 350 |
+
|
| 351 |
+
|
| 352 |
+
def run_on_load(ui_components):
|
| 353 |
+
cn_updates = initialize_all_cn_dropdowns(ui_components)
|
| 354 |
+
ipa_updates = initialize_all_ipa_dropdowns(ui_components)
|
| 355 |
+
return {**cn_updates, **ipa_updates}
|
| 356 |
+
|
| 357 |
+
|
| 358 |
+
def on_aspect_ratio_change(ratio_key, model_display_name):
|
| 359 |
+
m_type = MODEL_TYPE_MAP.get(model_display_name, 'SDXL')
|
| 360 |
+
architectures_dict = ARCHITECTURES_CONFIG.get('architectures', {})
|
| 361 |
+
arch_model_type = architectures_dict.get(m_type, {}).get("model_type", m_type.lower().replace(" ", "").replace(".", ""))
|
| 362 |
+
|
| 363 |
+
res_map = RESOLUTION_MAP.get(arch_model_type, RESOLUTION_MAP.get("sdxl", {}))
|
| 364 |
+
w, h = res_map.get(ratio_key, (1024, 1024))
|
| 365 |
return w, h
|
ui/layout.py
CHANGED
|
@@ -12,15 +12,7 @@ def build_ui(event_handler_function):
|
|
| 12 |
with gr.Blocks() as demo:
|
| 13 |
gr.Markdown("# ImageGen")
|
| 14 |
gr.Markdown(
|
| 15 |
-
"This demo is a streamlined version of the [Comfy web UI](https://github.com/RioShiina47/comfy-webui)'s [ImageGen](https://huggingface.co/spaces/RioShiina/ImageGen) functionality.
|
| 16 |
-
"Other spaces: [ImageGen1](https://huggingface.co/spaces/RioShiina/ImageGen1), "
|
| 17 |
-
"[ImageGen2](https://huggingface.co/spaces/RioShiina/ImageGen2), "
|
| 18 |
-
"[ImageGen3](https://huggingface.co/spaces/RioShiina/ImageGen3), "
|
| 19 |
-
"[ImageGen4](https://huggingface.co/spaces/RioShiina/ImageGen4), "
|
| 20 |
-
"[ImageGen5](https://huggingface.co/spaces/RioShiina/ImageGen5), "
|
| 21 |
-
"[ImageGen6](https://huggingface.co/spaces/RioShiina/ImageGen6), "
|
| 22 |
-
"[ImageGen7](https://huggingface.co/spaces/RioShiina/ImageGen7), "
|
| 23 |
-
"[ImageGen8](https://huggingface.co/spaces/RioShiina/ImageGen8)"
|
| 24 |
)
|
| 25 |
with gr.Tabs(elem_id="tabs_container") as tabs:
|
| 26 |
with gr.TabItem("Txt2Img", id=0):
|
|
|
|
| 12 |
with gr.Blocks() as demo:
|
| 13 |
gr.Markdown("# ImageGen")
|
| 14 |
gr.Markdown(
|
| 15 |
+
"This demo is a streamlined version of the [Comfy web UI](https://github.com/RioShiina47/comfy-webui)'s [ImageGen](https://huggingface.co/spaces/RioShiina/ImageGen) functionality."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
)
|
| 17 |
with gr.Tabs(elem_id="tabs_container") as tabs:
|
| 18 |
with gr.TabItem("Txt2Img", id=0):
|
ui/shared/ui_components.py
CHANGED
|
@@ -250,9 +250,8 @@ def create_anima_controlnet_lllite_ui(prefix: str, max_units=MAX_CONTROLNETS):
|
|
| 250 |
components = {}
|
| 251 |
key = lambda name: f"{name}_{prefix}"
|
| 252 |
|
| 253 |
-
with gr.Accordion("Anima ControlNet
|
| 254 |
components[key('anima_controlnet_lllite_accordion')] = accordion
|
| 255 |
-
gr.Markdown("💡 **Tip:** Processed using the [kohya-ss/ComfyUI-Anima-LLLite](https://github.com/kohya-ss/ComfyUI-Anima-LLLite) node.")
|
| 256 |
|
| 257 |
cn_rows, images, series, types, strengths, filepaths, start_percents, end_percents = [], [], [], [], [], [], [], []
|
| 258 |
components.update({
|
|
|
|
| 250 |
components = {}
|
| 251 |
key = lambda name: f"{name}_{prefix}"
|
| 252 |
|
| 253 |
+
with gr.Accordion("Anima ControlNet LLLite Settings", open=False, visible=('anima_controlnet_lllite' in default_enabled_chains)) as accordion:
|
| 254 |
components[key('anima_controlnet_lllite_accordion')] = accordion
|
|
|
|
| 255 |
|
| 256 |
cn_rows, images, series, types, strengths, filepaths, start_percents, end_percents = [], [], [], [], [], [], [], []
|
| 257 |
components.update({
|
yaml/anima_controlnet_lllite_models.yaml
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
Anima_ControlNet_Lllite:
|
| 2 |
-
- Filepath: "anima-lllite-
|
| 3 |
Series: "kohya-ss"
|
| 4 |
-
Type: ["
|
| 5 |
- Filepath: "anima-lllite-depth-1.safetensors"
|
| 6 |
Series: "kohya-ss"
|
| 7 |
Type: ["Depth"]
|
|
|
|
|
|
|
|
|
|
| 8 |
- Filepath: "anima-lllite-pose-1.safetensors"
|
| 9 |
Series: "kohya-ss"
|
| 10 |
Type: ["Pose"]
|
|
|
|
| 1 |
Anima_ControlNet_Lllite:
|
| 2 |
+
- Filepath: "anima-lllite-any-test-like-v2.safetensors"
|
| 3 |
Series: "kohya-ss"
|
| 4 |
+
Type: ["Any-Test"]
|
| 5 |
- Filepath: "anima-lllite-depth-1.safetensors"
|
| 6 |
Series: "kohya-ss"
|
| 7 |
Type: ["Depth"]
|
| 8 |
+
- Filepath: "anima-lllite-lineart-1.safetensors"
|
| 9 |
+
Series: "kohya-ss"
|
| 10 |
+
Type: ["Lineart"]
|
| 11 |
- Filepath: "anima-lllite-pose-1.safetensors"
|
| 12 |
Series: "kohya-ss"
|
| 13 |
Type: ["Pose"]
|
yaml/constants.yaml
CHANGED
|
@@ -199,6 +199,14 @@ RESOLUTION_MAP:
|
|
| 199 |
"3:4 (Classic Portrait)": [896, 1152]
|
| 200 |
"3:2 (Photography)": [1216, 832]
|
| 201 |
"2:3 (Photography Portrait)": [832, 1216]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
sd35:
|
| 203 |
"1:1 (Square)": [1024, 1024]
|
| 204 |
"16:9 (Landscape)": [1344, 768]
|
|
@@ -249,6 +257,7 @@ MULTIPLIERS_MAP:
|
|
| 249 |
hidream-o1: 32
|
| 250 |
hidream-i1: 1
|
| 251 |
flux1: 1
|
|
|
|
| 252 |
sd35: 1
|
| 253 |
sdxl: 1
|
| 254 |
sd15: 1
|
|
|
|
| 199 |
"3:4 (Classic Portrait)": [896, 1152]
|
| 200 |
"3:2 (Photography)": [1216, 832]
|
| 201 |
"2:3 (Photography Portrait)": [832, 1216]
|
| 202 |
+
auraflow:
|
| 203 |
+
"1:1 (Square)": [1024, 1024]
|
| 204 |
+
"16:9 (Landscape)": [1344, 768]
|
| 205 |
+
"9:16 (Portrait)": [768, 1344]
|
| 206 |
+
"4:3 (Classic)": [1152, 896]
|
| 207 |
+
"3:4 (Classic Portrait)": [896, 1152]
|
| 208 |
+
"3:2 (Photography)": [1216, 832]
|
| 209 |
+
"2:3 (Photography Portrait)": [832, 1216]
|
| 210 |
sd35:
|
| 211 |
"1:1 (Square)": [1024, 1024]
|
| 212 |
"16:9 (Landscape)": [1344, 768]
|
|
|
|
| 257 |
hidream-o1: 32
|
| 258 |
hidream-i1: 1
|
| 259 |
flux1: 1
|
| 260 |
+
auraflow: 1
|
| 261 |
sd35: 1
|
| 262 |
sdxl: 1
|
| 263 |
sd15: 1
|
yaml/file_list.yaml
CHANGED
|
@@ -14,6 +14,11 @@ file:
|
|
| 14 |
source: "hf"
|
| 15 |
repo_id: "Comfy-Org/Lumina_Image_2.0_Repackaged"
|
| 16 |
repository_file_path: "all_in_one/lumina_2.safetensors"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
# SD3.5
|
| 18 |
- filename: "sd3.5_large_fp8_scaled.safetensors"
|
| 19 |
source: "hf"
|
|
@@ -120,6 +125,11 @@ file:
|
|
| 120 |
source: "hf"
|
| 121 |
repo_id: "stabilityai/stable-diffusion-xl-base-1.0"
|
| 122 |
repository_file_path: "sd_xl_base_1.0.safetensors"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
# SD1.5
|
| 124 |
- filename: "v1-5-pruned-emaonly.safetensors"
|
| 125 |
source: "hf"
|
|
@@ -146,23 +156,6 @@ file:
|
|
| 146 |
repo_id: "Comfy-Org/sigclip_vision_384"
|
| 147 |
repository_file_path: "sigclip_vision_patch14_384.safetensors"
|
| 148 |
controlnet:
|
| 149 |
-
# Anima
|
| 150 |
-
- filename: "anima-lllite-lineart-1.safetensors"
|
| 151 |
-
source: "hf"
|
| 152 |
-
repo_id: "kohya-ss/Anima-LLLite"
|
| 153 |
-
repository_file_path: "anima-lllite-lineart-1.safetensors"
|
| 154 |
-
- filename: "anima-lllite-depth-1.safetensors"
|
| 155 |
-
source: "hf"
|
| 156 |
-
repo_id: "kohya-ss/Anima-LLLite"
|
| 157 |
-
repository_file_path: "anima-lllite-depth-1.safetensors"
|
| 158 |
-
- filename: "anima-lllite-pose-1.safetensors"
|
| 159 |
-
source: "hf"
|
| 160 |
-
repo_id: "kohya-ss/Anima-LLLite"
|
| 161 |
-
repository_file_path: "anima-lllite-pose-1.safetensors"
|
| 162 |
-
- filename: "anima-lllite-scribble-1.safetensors"
|
| 163 |
-
source: "hf"
|
| 164 |
-
repo_id: "kohya-ss/Anima-LLLite"
|
| 165 |
-
repository_file_path: "anima-lllite-scribble-1.safetensors"
|
| 166 |
# SD3.5
|
| 167 |
- filename: "sd3.5_large_controlnet_blur.safetensors"
|
| 168 |
source: "hf"
|
|
@@ -749,6 +742,27 @@ file:
|
|
| 749 |
repo_id: "h94/IP-Adapter-FaceID"
|
| 750 |
repository_file_path: "ip-adapter-faceid-plusv2_sdxl_lora.safetensors"
|
| 751 |
model_patches:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 752 |
# Z-Image
|
| 753 |
- filename: "Z-Image-Turbo-Fun-Controlnet-Union-2.1-8steps.safetensors"
|
| 754 |
source: "hf"
|
|
|
|
| 14 |
source: "hf"
|
| 15 |
repo_id: "Comfy-Org/Lumina_Image_2.0_Repackaged"
|
| 16 |
repository_file_path: "all_in_one/lumina_2.safetensors"
|
| 17 |
+
# AuraFlow
|
| 18 |
+
- filename: "aura_flow_0.3.safetensors"
|
| 19 |
+
source: "hf"
|
| 20 |
+
repo_id: "fal/AuraFlow-v0.3"
|
| 21 |
+
repository_file_path: "aura_flow_0.3.safetensors"
|
| 22 |
# SD3.5
|
| 23 |
- filename: "sd3.5_large_fp8_scaled.safetensors"
|
| 24 |
source: "hf"
|
|
|
|
| 125 |
source: "hf"
|
| 126 |
repo_id: "stabilityai/stable-diffusion-xl-base-1.0"
|
| 127 |
repository_file_path: "sd_xl_base_1.0.safetensors"
|
| 128 |
+
# SDXL-Turbo
|
| 129 |
+
- filename: "sd_xl_turbo_1.0_fp16.safetensors"
|
| 130 |
+
source: "hf"
|
| 131 |
+
repo_id: "stabilityai/sdxl-turbo"
|
| 132 |
+
repository_file_path: "sd_xl_turbo_1.0_fp16.safetensors"
|
| 133 |
# SD1.5
|
| 134 |
- filename: "v1-5-pruned-emaonly.safetensors"
|
| 135 |
source: "hf"
|
|
|
|
| 156 |
repo_id: "Comfy-Org/sigclip_vision_384"
|
| 157 |
repository_file_path: "sigclip_vision_patch14_384.safetensors"
|
| 158 |
controlnet:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
# SD3.5
|
| 160 |
- filename: "sd3.5_large_controlnet_blur.safetensors"
|
| 161 |
source: "hf"
|
|
|
|
| 742 |
repo_id: "h94/IP-Adapter-FaceID"
|
| 743 |
repository_file_path: "ip-adapter-faceid-plusv2_sdxl_lora.safetensors"
|
| 744 |
model_patches:
|
| 745 |
+
# Anima
|
| 746 |
+
- filename: "anima-lllite-any-test-like-v2.safetensors"
|
| 747 |
+
source: "hf"
|
| 748 |
+
repo_id: "Comfy-Org/Anima-LLLite"
|
| 749 |
+
repository_file_path: "model_patches/anima-lllite-any-test-like-v2.safetensors"
|
| 750 |
+
- filename: "anima-lllite-lineart-1.safetensors"
|
| 751 |
+
source: "hf"
|
| 752 |
+
repo_id: "Comfy-Org/Anima-LLLite"
|
| 753 |
+
repository_file_path: "model_patches/anima-lllite-lineart-1.safetensors"
|
| 754 |
+
- filename: "anima-lllite-depth-1.safetensors"
|
| 755 |
+
source: "hf"
|
| 756 |
+
repo_id: "Comfy-Org/Anima-LLLite"
|
| 757 |
+
repository_file_path: "model_patches/anima-lllite-depth-1.safetensors"
|
| 758 |
+
- filename: "anima-lllite-pose-1.safetensors"
|
| 759 |
+
source: "hf"
|
| 760 |
+
repo_id: "Comfy-Org/Anima-LLLite"
|
| 761 |
+
repository_file_path: "model_patches/anima-lllite-pose-1.safetensors"
|
| 762 |
+
- filename: "anima-lllite-scribble-1.safetensors"
|
| 763 |
+
source: "hf"
|
| 764 |
+
repo_id: "Comfy-Org/Anima-LLLite"
|
| 765 |
+
repository_file_path: "model_patches/anima-lllite-scribble-1.safetensors"
|
| 766 |
# Z-Image
|
| 767 |
- filename: "Z-Image-Turbo-Fun-Controlnet-Union-2.1-8steps.safetensors"
|
| 768 |
source: "hf"
|
yaml/image_gen_features.yaml
CHANGED
|
@@ -162,6 +162,12 @@ flux1:
|
|
| 162 |
- vae
|
| 163 |
- pid
|
| 164 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
sd35:
|
| 166 |
enabled_chains:
|
| 167 |
- lora
|
|
|
|
| 162 |
- vae
|
| 163 |
- pid
|
| 164 |
|
| 165 |
+
auraflow:
|
| 166 |
+
enabled_chains:
|
| 167 |
+
- lora
|
| 168 |
+
- conditioning
|
| 169 |
+
- vae
|
| 170 |
+
|
| 171 |
sd35:
|
| 172 |
enabled_chains:
|
| 173 |
- lora
|
yaml/model_architectures.yaml
CHANGED
|
@@ -23,6 +23,7 @@ architecture_order:
|
|
| 23 |
- "HiDream-O1"
|
| 24 |
- "HiDream-I1"
|
| 25 |
- "FLUX.1"
|
|
|
|
| 26 |
- "SD3.5"
|
| 27 |
- "SDXL"
|
| 28 |
- "SD1.5"
|
|
@@ -88,6 +89,9 @@ architectures:
|
|
| 88 |
"FLUX.1":
|
| 89 |
model_type: "flux1"
|
| 90 |
controlnet_key: "FLUX.1"
|
|
|
|
|
|
|
|
|
|
| 91 |
"SDXL":
|
| 92 |
model_type: "sdxl"
|
| 93 |
controlnet_key: "SDXL"
|
|
|
|
| 23 |
- "HiDream-O1"
|
| 24 |
- "HiDream-I1"
|
| 25 |
- "FLUX.1"
|
| 26 |
+
- "AuraFlow"
|
| 27 |
- "SD3.5"
|
| 28 |
- "SDXL"
|
| 29 |
- "SD1.5"
|
|
|
|
| 89 |
"FLUX.1":
|
| 90 |
model_type: "flux1"
|
| 91 |
controlnet_key: "FLUX.1"
|
| 92 |
+
"AuraFlow":
|
| 93 |
+
model_type: "auraflow"
|
| 94 |
+
controlnet_key: "AuraFlow"
|
| 95 |
"SDXL":
|
| 96 |
model_type: "sdxl"
|
| 97 |
controlnet_key: "SDXL"
|
yaml/model_defaults.yaml
CHANGED
|
@@ -243,6 +243,19 @@ FLUX.1:
|
|
| 243 |
sampler_name: "euler"
|
| 244 |
scheduler: "simple"
|
| 245 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 246 |
SD3.5:
|
| 247 |
_defaults:
|
| 248 |
steps: 20
|
|
@@ -254,10 +267,12 @@ SDXL:
|
|
| 254 |
_defaults:
|
| 255 |
steps: 25
|
| 256 |
cfg: 7.0
|
| 257 |
-
sampler_name: "
|
| 258 |
scheduler: "simple"
|
| 259 |
-
|
| 260 |
-
|
|
|
|
|
|
|
| 261 |
|
| 262 |
SD1.5:
|
| 263 |
_defaults:
|
|
|
|
| 243 |
sampler_name: "euler"
|
| 244 |
scheduler: "simple"
|
| 245 |
|
| 246 |
+
AuraFlow:
|
| 247 |
+
_defaults:
|
| 248 |
+
steps: 20
|
| 249 |
+
cfg: 3.5
|
| 250 |
+
sampler_name: "euler"
|
| 251 |
+
scheduler: "sgm_uniform"
|
| 252 |
+
"PurpleSmartAI/Pony-V7-Base":
|
| 253 |
+
steps: 40
|
| 254 |
+
cfg: 3.5
|
| 255 |
+
sampler_name: "euler"
|
| 256 |
+
scheduler: "simple"
|
| 257 |
+
positive_prompt: "special tags, factual description of image, stylistic description of image, additional content tags"
|
| 258 |
+
|
| 259 |
SD3.5:
|
| 260 |
_defaults:
|
| 261 |
steps: 20
|
|
|
|
| 267 |
_defaults:
|
| 268 |
steps: 25
|
| 269 |
cfg: 7.0
|
| 270 |
+
sampler_name: "euler_ancestral"
|
| 271 |
scheduler: "simple"
|
| 272 |
+
"stabilityai/SDXL-Turbo-1.0":
|
| 273 |
+
steps: 1
|
| 274 |
+
cfg: 1.0
|
| 275 |
+
positive_prompt: "NOTE: The model generates images of size 512x512 but higher image sizes work as well."
|
| 276 |
|
| 277 |
SD1.5:
|
| 278 |
_defaults:
|
yaml/model_list.yaml
CHANGED
|
@@ -324,6 +324,11 @@ Checkpoint:
|
|
| 324 |
vae: "ae.safetensors"
|
| 325 |
clip1: "clip_l.safetensors"
|
| 326 |
clip2: "t5xxl_fp8_e4m3fn_scaled.safetensors"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
SD3.5:
|
| 328 |
latent_type: sd3_latent
|
| 329 |
models:
|
|
@@ -405,9 +410,13 @@ Checkpoint:
|
|
| 405 |
path: "CyberRealisticPony_V17.0_FP16.safetensors"
|
| 406 |
category: "Pony"
|
| 407 |
# SDXL-Base
|
| 408 |
-
- display_name: "stabilityai/
|
| 409 |
path: "sd_xl_base_1.0.safetensors"
|
| 410 |
category: "Base"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 411 |
SD1.5:
|
| 412 |
latent_type: latent
|
| 413 |
models:
|
|
|
|
| 324 |
vae: "ae.safetensors"
|
| 325 |
clip1: "clip_l.safetensors"
|
| 326 |
clip2: "t5xxl_fp8_e4m3fn_scaled.safetensors"
|
| 327 |
+
AuraFlow:
|
| 328 |
+
latent_type: latent
|
| 329 |
+
models:
|
| 330 |
+
- display_name: "fal/AuraFlow-v0.3"
|
| 331 |
+
path: "aura_flow_0.3.safetensors"
|
| 332 |
SD3.5:
|
| 333 |
latent_type: sd3_latent
|
| 334 |
models:
|
|
|
|
| 410 |
path: "CyberRealisticPony_V17.0_FP16.safetensors"
|
| 411 |
category: "Pony"
|
| 412 |
# SDXL-Base
|
| 413 |
+
- display_name: "stabilityai/SDXL-Base-1.0"
|
| 414 |
path: "sd_xl_base_1.0.safetensors"
|
| 415 |
category: "Base"
|
| 416 |
+
# SDXL-Turbo
|
| 417 |
+
- display_name: "stabilityai/SDXL-Turbo-1.0"
|
| 418 |
+
path: "sd_xl_turbo_1.0_fp16.safetensors"
|
| 419 |
+
category: "Turbo"
|
| 420 |
SD1.5:
|
| 421 |
latent_type: latent
|
| 422 |
models:
|