Make Qwen Image 2.1 the production image worker

This commit is contained in:
Mikei386
2026-09-21 10:41:32 +02:00
parent aee31aa045
commit 5de4ac4b25
19 changed files with 531 additions and 346 deletions
@@ -27,8 +27,8 @@ LABEL_KEY = "com.mike-ai.llama-profile"
IMAGE_LABEL_KEY = "com.mike-ai.image-worker"
IMAGE_WORKER = os.environ.get("IMAGE_WORKER", "image")
RESTORE_WORKER = os.environ.get("RESTORE_WORKER", "restore")
QWEN_IMAGE_TEST_WORKER = os.environ.get(
"QWEN_IMAGE_TEST_WORKER", "qwen-image-2.1-test").strip()
FLUX_STANDBY_WORKER = os.environ.get(
"FLUX_STANDBY_WORKER", "flux-standby").strip()
TTS_LABEL_KEY = "com.mike-ai.tts-worker"
TTS_WORKER = os.environ.get("TTS_WORKER", "qwen3")
MUSIC_LABEL_KEY = "com.mike-ai.music-worker"
@@ -103,8 +103,8 @@ def image_container(kind: str = IMAGE_WORKER) -> dict:
def image_containers() -> list[dict]:
"""All allowlisted GPU workers that must never overlap an LLM."""
allowed = {IMAGE_WORKER, RESTORE_WORKER}
if QWEN_IMAGE_TEST_WORKER:
allowed.add(QWEN_IMAGE_TEST_WORKER)
if FLUX_STANDBY_WORKER:
allowed.add(FLUX_STANDBY_WORKER)
return [item for item in labelled_containers(IMAGE_LABEL_KEY)
if item.get("Labels", {}).get(IMAGE_LABEL_KEY) in allowed]
@@ -363,7 +363,7 @@ def stop_inference() -> dict:
def set_image_worker(running: bool, kind: str = IMAGE_WORKER) -> dict:
if kind not in {IMAGE_WORKER, RESTORE_WORKER, QWEN_IMAGE_TEST_WORKER}:
if kind not in {IMAGE_WORKER, RESTORE_WORKER, FLUX_STANDBY_WORKER}:
raise ValueError("worker is not allowlisted")
with LOCK:
item = image_container(kind)
@@ -371,8 +371,8 @@ def set_image_worker(running: bool, kind: str = IMAGE_WORKER) -> dict:
# The image worker may never overlap a llama profile on the 5080.
for profile_item in containers().values():
stop_container(profile_item)
# The 9B beta text encoder temporarily borrows the RTX 3060 from
# Qwen3-TTS. TTS is unavailable during this exclusive GPU phase.
# Image workers are GPU-exclusive. The FLUX standby also borrows
# the RTX 3060, while Qwen Image runs only on the RTX 5080.
stop_container(tts_container(), timeout=30)
stop_music_if_configured()
stop_yue2_if_configured()
@@ -801,8 +801,8 @@ class Handler(BaseHTTPRequestHandler):
"/workers/image/stop": (IMAGE_WORKER, False),
"/workers/restore/start": (RESTORE_WORKER, True),
"/workers/restore/stop": (RESTORE_WORKER, False),
"/workers/qwen-image-test/start": (QWEN_IMAGE_TEST_WORKER, True),
"/workers/qwen-image-test/stop": (QWEN_IMAGE_TEST_WORKER, False),
"/workers/flux-standby/start": (FLUX_STANDBY_WORKER, True),
"/workers/flux-standby/stop": (FLUX_STANDBY_WORKER, False),
}
if self.path in worker_paths:
try: