#!/usr/bin/env bash # Download pinned official weights and prepare the production worker stopped. set -Eeuo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" ENV_FILE=${STACK_ENV:-/etc/mike-ai/stack.env} MODEL_DIR=${QWEN_IMAGE_21_MODEL_DIR:-/data/models/Qwen-Image-2.1-ComfyUI} BASE=https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/ace0edeb3791a594ddfa36ed5f41a178a394e921 download() { local relative=$1 expected=$2 target="$MODEL_DIR/$1" install -d -m 0755 "$(dirname "$target")" if [[ -f $target ]] && echo "$expected $target" | sha256sum -c --status; then echo "OK: $relative" return fi curl -fL --retry 5 --retry-all-errors -C - -o "$target.part" "$BASE/$relative" echo "$expected $target.part" | sha256sum -c --status mv "$target.part" "$target" } download diffusion_models/qwen_image_2.1_int8_convrot.safetensors cb74113cb03faecd79611b01fd7fd642f0aa60d6f0b95086abee214d75eaa57d download text_encoders/qwen3vl_8b_int8_convrot.safetensors 8bfd0f6e12abf2d2d697ecc888e5e90b0d6741d6708f05799f53afa560452e8f download vae/qwen_image_2.1_vae_bf16.safetensors bb21f7473051e1ac368515dd3f2e15cd44d7a11748ee8823e1ddca3e4876b7c9 compose=(docker compose --env-file "$ENV_FILE" -f "$ROOT_DIR/compose.yaml" --profile image --profile flux-standby) "${compose[@]}" build image-worker "${compose[@]}" up -d --build --no-deps profile-controller "${compose[@]}" create image-worker flux-image-worker "${compose[@]}" stop image-worker flux-image-worker state=$(docker inspect -f '{{.State.Status}}' mike-ai-image-worker) [[ $state == exited || $state == created ]] echo "Qwen-Image-2.1 production worker and FLUX standby are prepared and stopped."