Download code/scripts/device_server_smoke.sh from changh95/laya: direct link, hf CLI and curl.
- Browser
- Download file 1.33 kB
-
https://huggingface.co/changh95/laya/resolve/main/code/scripts/device_server_smoke.sh
- Command line
-
hf download hf://changh95/laya/code/scripts/device_server_smoke.sh
-
curl -L -o device_server_smoke.sh https://huggingface.co/changh95/laya/resolve/main/code/scripts/device_server_smoke.sh
1.33 kB
| # SPDX-License-Identifier: Apache-2.0 | |
| # Serving gate on the host (no container): start the HTTP server on the device, run server/smoke_test.py against it, | |
| # stop the server. The server is the ONLY device process; run the whole script inside one device-lock window: | |
| # | |
| # bin/devrun -t 900 --reset-on-timeout -- bash code/scripts/device_server_smoke.sh [port] [out.json] | |
| # | |
| # Env: the server's LAYA_* configuration (defaults: profile english, engine mk, ETH dispatch; LAYA_WEIGHTS_DIR for a local snapshot). Exit code: the smoke test's. | |
| set -u | |
| PORT="${1:-20223}" | |
| OUT="${2:-}" | |
| HERE="$(cd "$(dirname "$0")" && pwd)" | |
| CODE="$(cd "$HERE/.." && pwd)" | |
| # run outside code/ (tt-metal writes generated/ into the CWD); the package comes from PYTHONPATH | |
| RUN="${LAYA_RUN_DIR:-${TMPDIR:-/tmp}/laya-server-smoke}" | |
| mkdir -p "$RUN" && cd "$RUN" | |
| export PYTHONPATH="$CODE${PYTHONPATH:+:$PYTHONPATH}" | |
| export TT_MESH_SHAPE="${TT_MESH_SHAPE:-1x1}" | |
| python -u -m uvicorn --host 127.0.0.1 --port "$PORT" --lifespan on tt_laya.server.app:app & | |
| SRV=$! | |
| stop() { kill -TERM "$SRV" 2>/dev/null; for _ in $(seq 1 60); do kill -0 "$SRV" 2>/dev/null || break; sleep 1; done; } | |
| trap stop EXIT | |
| python3 "$HERE/../tt_laya/server/smoke_test.py" --url "http://127.0.0.1:$PORT" --wait 900 \ | |
| --expect-engine "${LAYA_ENGINE:-mk}" ${OUT:+--out "$OUT"} | |