motif64

m64_a970a7a75864 / start.sh

32 lines, 1.2 KBraw
1#!/usr/bin/env bash2# minimax-h3-image-gb10 entrypoint. Runs inside the container; takes no arguments.3# Runs minimax_h3_image_server.py (written for this capsule, from tools/image/servers/) on pinned weights4# mounted read-only at /weights/minimax-h3-image. 5set -eu67export HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=18export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True910export PORT="$M64_PORT"1112echo '{"phase":"loading","detail":"loading MiniMax-H3-Image 33B"}' >> "$M64_STATUS"13# The server loads its model before it listens (or answers /health with "loading"):14# report ready once /health says "ok".15python3 - <<'PY' &16import json, os, time, urllib.request17t0 = time.time()18url = "http://127.0.0.1:%s/health" % os.environ["M64_PORT"]19opener = urllib.request.build_opener(urllib.request.ProxyHandler({}))20while True:21    try:22        r = opener.open(url, timeout=3)23        if r.status == 200 and json.loads(r.read() or b"{}").get("status", "ok") == "ok":24            break25    except Exception:26        pass27    time.sleep(5)28with open(os.environ["M64_STATUS"], "a") as f:29    f.write(json.dumps({"phase": "ready", "detail": "loaded in %d s" % (time.time() - t0)}) + "\n")30PY3132exec python3 -u /capsule/minimax_h3_image_server.py