Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion ai_diffusion/backend/comfy_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,17 @@ def find_model(model_list: Sequence[str], id: ResourceId):

def _find_text_encoder_models(model_list: Sequence[str]):
kind = ResourceKind.text_encoder
tes = ["clip_l", "clip_g", "t5", "qwen", "qwen_3_06b", "qwen_3_4b", "qwen_3_8b", "ministral"]
tes = [
"clip_l",
"clip_g",
"t5",
"qwen",
"qwen_3_06b",
"qwen_3_4b",
"qwen_3_8b",
"qwen3vl_4b",
"ministral",
]
return {
resource_id(kind, Arch.all, te): _find_model(model_list, kind, Arch.all, te) for te in tes
}
Expand Down
10 changes: 10 additions & 0 deletions ai_diffusion/backend/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class Arch(Enum):
anima = "Anima"
zimage = "Z-Image"
ernie = "ERNIE Image"
krea2 = "Krea 2"

auto = "Automatic"
all = "All"
Expand Down Expand Up @@ -142,6 +143,8 @@ def from_string(string: str, model_type: str = "eps", filename: str | None = Non
return Arch.zimage
if string in {"ernie-image", "ernie_image"}:
return Arch.ernie
if string == "krea2":
return Arch.krea2
return None

@staticmethod
Expand Down Expand Up @@ -249,6 +252,8 @@ def text_encoders(self):
return ["qwen_3_4b"]
case Arch.ernie:
return ["ministral"]
case Arch.krea2:
return ["qwen3vl_4b"]
raise ValueError(f"Unsupported architecture: {self}")

@staticmethod
Expand All @@ -271,6 +276,7 @@ def list():
Arch.anima,
Arch.zimage,
Arch.ernie,
Arch.krea2,
]


Expand Down Expand Up @@ -818,6 +824,7 @@ def is_required(kind: ResourceKind, arch: Arch, identifier: ControlMode | Upscal
resource_id(ResourceKind.text_encoder, Arch.all, "qwen_3_8b"): ["qwen_3_8b", "qwen3-8b", "qwen3_8b"],
resource_id(ResourceKind.text_encoder, Arch.all, "qwen_3_06b"): ["qwen_3_06b", "qwen3-06b", "qwen3_06b"],
resource_id(ResourceKind.text_encoder, Arch.all, "ministral"): ["ministral-3-3b", "ministral"],
resource_id(ResourceKind.text_encoder, Arch.all, "qwen3vl_4b"): ["qwen3vl_4b"],
resource_id(ResourceKind.vae, Arch.sd15, "default"): ["vae-ft-mse-840000-ema"],
resource_id(ResourceKind.vae, Arch.sdxl, "default"): ["sdxl_vae"],
resource_id(ResourceKind.vae, Arch.illu, "default"): ["sdxl_vae"],
Expand All @@ -835,6 +842,7 @@ def is_required(kind: ResourceKind, arch: Arch, identifier: ControlMode | Upscal
resource_id(ResourceKind.vae, Arch.anima, "default"): ["qwen_image"],
resource_id(ResourceKind.vae, Arch.zimage, "default"): ["z-image", "flux-", "flux_", "flux/", "flux1", "ae.s"],
resource_id(ResourceKind.vae, Arch.ernie, "default"): ["flux2"],
resource_id(ResourceKind.vae, Arch.krea2, "default"): ["qwen_image"],
}
# fmt: on

Expand Down Expand Up @@ -870,6 +878,8 @@ def is_required(kind: ResourceKind, arch: Arch, identifier: ControlMode | Upscal
ResourceId(ResourceKind.vae, Arch.flux2_9b, "default"),
ResourceId(ResourceKind.text_encoder, Arch.ernie, "ministral"),
ResourceId(ResourceKind.vae, Arch.ernie, "default"),
ResourceId(ResourceKind.text_encoder, Arch.krea2, "qwen3vl_4b"),
ResourceId(ResourceKind.vae, Arch.krea2, "default"),
}

recommended_resource_ids = [
Expand Down
2 changes: 2 additions & 0 deletions ai_diffusion/backend/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ def load_checkpoint_with_lora(w: ComfyWorkflow, checkpoint: CheckpointInput, mod
clip = w.load_clip(te["qwen_3_4b"], type="lumina2")
case Arch.ernie:
clip = w.load_clip(te["ministral"], type="flux2")
case Arch.krea2:
clip = w.load_clip(te["qwen3vl_4b"], type="krea2")
case _:
raise RuntimeError(f"No text encoder for model architecture {arch.name}")

Expand Down
11 changes: 11 additions & 0 deletions ai_diffusion/icons/sd-version-krea2-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions ai_diffusion/icons/sd-version-krea2-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions ai_diffusion/ui/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ def checkpoint_icon(arch: Arch, format: FileFormat | None = None, client: Client
return icon("sd-version-anima")
elif arch is Arch.ernie:
return icon("sd-version-ernie")
elif arch is Arch.krea2:
return icon("sd-version-krea2")
else:
log.warning(f"Unresolved SD version {arch}, cannot fetch icon")
return icon("warning")
Expand Down
1 change: 1 addition & 0 deletions tests/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def test_resource_ids_exist():
Arch.flux2_9b,
Arch.anima,
Arch.ernie,
Arch.krea2,
):
continue # no model downloads yet
model = res.find_resource(resource_id)
Expand Down
Loading