fix(mflux_image_edit): fleet-standard LoRA stash path

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
John King 2026-08-24 11:51:35 +10:00
parent eed95c45f6
commit 8c63e21df7
2 changed files with 14 additions and 6 deletions

View File

@ -42,7 +42,7 @@
"loras": {
"type": "string",
"default": "",
"description": "Qwen-Edit LoRAs, comma-separated 'name' or 'name:scale' (e.g. 'qwen-studio-realism:0.8,gymnast'). Resolved from ~/Documents/localmodels/qwen-loras (mirror of ultra civit/_parked-qwen). Wrong-base LoRAs are silent no-ops."
"description": "Qwen-Edit LoRAs, comma-separated 'name' or 'name:scale' (e.g. 'qwen-studio-realism:0.8,gymnast'). Resolved from ~/Documents/localmodels/QwenLora on both mflux nodes (QWEN_LORA_DIRS overrides). Wrong-base LoRAs are silent no-ops."
}
}
}

View File

@ -1,5 +1,6 @@
import argparse
import json
import os
import subprocess
import sys
from pathlib import Path
@ -35,13 +36,20 @@ cmd = [str(cli), "--image-paths", *[str(Path(x).resolve()) for x in a.input],
"--output", str(out.resolve())]
# Qwen-Edit LoRAs: "name" or "name:scale", comma-separated. Names resolve
# (case-insensitive prefix match) against ~/Documents/localmodels/qwen-loras,
# which mirrors ultra's civit/_parked-qwen stash. mflux natively takes
# --lora-paths/--lora-scales; a LoRA for the wrong base is a silent no-op.
LORA_DIR = Path.home() / "Documents" / "localmodels" / "qwen-loras"
# (case-insensitive prefix match) against the fleet-standard stash, which is
# present on BOTH mflux nodes (m3ultra + ultra) — a job can dispatch to either,
# so a node-local dir would resolve on one and fail on the other.
# mflux natively takes --lora-paths/--lora-scales; a LoRA for the wrong base
# model is a SILENT no-op (no error, the edit just ignores it).
LORA_DIRS = [Path(d).expanduser() for d in
(os.environ.get("QWEN_LORA_DIRS") or "").split(os.pathsep) if d.strip()] \
or [Path.home() / "Documents" / "localmodels" / "QwenLora"]
if p.get("loras"):
paths, scales = [], []
avail = {f.name.lower(): f for f in LORA_DIR.rglob("*.safetensors")}
avail = {}
for d in LORA_DIRS:
for f in d.rglob("*.safetensors"):
avail.setdefault(f.name.lower(), f)
for item in str(p["loras"]).split(","):
item = item.strip()
if not item: