m64_03766c1334c5 / start.sh
35 lines, 1.5 KBraw
1#!/usr/bin/env bash2# sensenova-u1.5-8b-base-gb10 entrypoint. Runs inside the container; takes no arguments.3# Port of gx10 ~/code/vlmtest/machines/gx10/start_sensenova_u1_base.sh: the same server4# (vlmtest/sensenova_u1_server.py, copied unchanged) with the same env, on pinned weights mounted5# read-only at /weights/model. Same server as gx10, the vendor package baked into the image (it self-registers its model with transformers, so no trust_remote_code).6set -eu78export HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=19export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True10export MODEL_DIR="/weights/model"11export SERVED_MODEL_ID="sensenova-u1.5-8b-mot"12export SENSENOVA_LORA=""13export PORT="$M64_PORT"1415echo '{"phase":"loading","detail":"loading SenseNova-U1.5-8B-MoT (base, 50 steps)"}' >> "$M64_STATUS"16# The server loads its model before it listens (or answers /health with "loading"):17# report ready once /health says "ok".18python3 - <<'PY' &19import json, os, time, urllib.request20t0 = time.time()21url = "http://127.0.0.1:%s/health" % os.environ["M64_PORT"]22opener = urllib.request.build_opener(urllib.request.ProxyHandler({}))23while True:24 try:25 r = opener.open(url, timeout=3)26 if r.status == 200 and json.loads(r.read() or b"{}").get("status", "ok") == "ok":27 break28 except Exception:29 pass30 time.sleep(5)31with open(os.environ["M64_STATUS"], "a") as f:32 f.write(json.dumps({"phase": "ready", "detail": "loaded in %d s" % (time.time() - t0)}) + "\n")33PY3435exec python3 -u /capsule/sensenova_u1_server.py