#!/usr/bin/env bash set -euo pipefail COMFY_DIR="${COMFY_DIR:-/opt/powerpack-h3/ComfyUI}" PORT="${H3_PORT:-8188}" RESERVE="${H3_RESERVE_VRAM:-48}" HEADROOM="${H3_VRAM_HEADROOM:-10}" LISTEN="${H3_LISTEN:-0.0.0.0}" export PATH="/usr/local/cuda/bin:${COMFY_DIR}/.venv/bin:${PATH:-}" export CUDA_HOME="${CUDA_HOME:-/usr/local/cuda}" export LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH:-}" cd "$COMFY_DIR" # Ensure model dir skeleton (weights mounted by user) mkdir -p models/{diffusion_models,text_encoders/H3,vae,upscale_models,loras} output input temp # SEALED CONFIG: STOCK int8-convrot TE is the default (heretic TE retired — # Heretic's author does not recommend heretic models for H3). if [[ -f models/text_encoders/qwen3vl_32b_minimax_h3_int8_convrot.safetensors ]]; then : # stock TE in place — nothing to do elif [[ -f models/text_encoders/H3/qwen3vl_32b_heretic_minimax_h3_nvfp4.safetensors ]]; then echo "WARN: only the RETIRED heretic TE found — falling back, but fetch the stock" >&2 echo " int8-convrot TE (scripts/fetch_weights.sh) for the sealed config." >&2 ln -sfn H3/qwen3vl_32b_heretic_minimax_h3_nvfp4.safetensors \ models/text_encoders/qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors fi # Optional stack verify if [[ "${H3_VERIFY:-1}" == "1" ]] && [[ -x /opt/powerpack-h3/scripts/verify_h3_stack.sh ]]; then /opt/powerpack-h3/scripts/verify_h3_stack.sh --offline || { echo "WARN: offline verify failed (continuing); set H3_VERIFY=0 to silence" >&2 } fi echo "=== keys-2k MiniMax-H3 Parallel (Two DGX Sparks) ===" echo " ComfyUI: $COMFY_DIR" echo " listen: ${LISTEN}:${PORT}" echo " flags: --disable-pinned-memory --reserve-vram ${RESERVE} --vram-headroom ${HEADROOM}" echo " turbo: OFF for quality (do not pass few-step turbo graphs for deliverables)" echo " 2K path: native 704x1280 → RealESRGAN x2 → ~1408x2560" echo # Never --use-sage-attention CLI (noise on H3); Sage is in-graph via PathchSageAttentionKJ exec "${COMFY_DIR}/.venv/bin/python" main.py \ --listen "$LISTEN" \ --port "$PORT" \ --disable-pinned-memory \ --reserve-vram "$RESERVE" \ --vram-headroom "$HEADROOM" \ "$@"