m64_2c2c650e3e7f / start.sh
36 lines, 1.5 KBraw
1#!/usr/bin/env bash2# kromoss-gb10 entrypoint. Runs inside the container; takes no arguments.3# Port of gx10 ~/code/vlmtest/machines/gx10/start_kromoss.sh: the same server4# (vlmtest/moss_image_server.py, copied unchanged) with the same env, on pinned weights mounted5# read-only at /weights/kromoss. start_moss_image.sh is the shared body gx10's per-variant scripts exec; the LoRAs ship in the same repo, so MOSS_LORA_DIR is the weights mount.6set -eu78export HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=19export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True10export MODEL_DIR="/weights/kromoss"11export MOSS_LORA=""12export MOSS_LORA_DIR="/weights/kromoss"13export SERVED_MODEL_ID="kromoss"14export PORT="$M64_PORT"1516echo '{"phase":"loading","detail":"loading Kromoss (full, 50 steps)"}' >> "$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