motif64

m64_2804b385e240 / start.sh

36 lines, 1.6 KBraw
1#!/usr/bin/env bash2# moss-image-base-dmd2-gb10 entrypoint. Runs inside the container; takes no arguments.3# Port of gx10 ~/code/vlmtest/machines/gx10/start_moss_image.sh: the same server4# (vlmtest/moss_image_server.py, copied unchanged) with the same env, on pinned weights mounted5# read-only at /weights/moss-image-base. start_moss_image.sh is the shared body gx10's MOSS-Image scripts exec; this variant's LoRA is its own repo (data-archetype/moss_image_base_dmd2), mounted at MOSS_LORA_DIR.6set -eu78export HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=19export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True10export MODEL_DIR="/weights/moss-image-base"11export MOSS_LORA="base-dmd2"12export MOSS_LORA_DIR="/weights/moss-base-dmd2"13export SERVED_MODEL_ID="moss-image-base-dmd2"14export PORT="$M64_PORT"1516echo '{"phase":"loading","detail":"loading MOSS-Image-Base + DMD2 8-step"}' >> "$M64_STATUS"17# The server loads its model before it listens (or answers /health with "loading"):18# report ready once /health says "ok".19python3 - <<'PY' &20import json, os, time, urllib.request21t0 = time.time()22url = "http://127.0.0.1:%s/health" % os.environ["M64_PORT"]23opener = urllib.request.build_opener(urllib.request.ProxyHandler({}))24while True:25    try:26        r = opener.open(url, timeout=3)27        if r.status == 200 and json.loads(r.read() or b"{}").get("status", "ok") == "ok":28            break29    except Exception:30        pass31    time.sleep(5)32with open(os.environ["M64_STATUS"], "a") as f:33    f.write(json.dumps({"phase": "ready", "detail": "loaded in %d s" % (time.time() - t0)}) + "\n")34PY3536exec python3 -u /capsule/moss_image_server.py