mirror of
https://github.com/hanzoai/laya.git
synced 2026-10-30 19:33:31 +00:00
* build(docker): add ARM64 and DGX Spark container builds The quickstart image builds natively on ARM64, and a DGX Spark override selects ARM64 with CUDA 13.0. PyTorch and the Python base image become build arguments, with torch pinned at 2.14.0, so a new torch release cannot change the image under an unrelated PR. PyTorch's ARM64 CUDA 13.0 wheels depend on cuSPARSELt 0.8.0 (torch 2.11) or 0.8.1 (torch 2.14), whose wheels declare an SBSA tag that pip check rejects. docker/check_torch.py checks the library is ELF64 AArch64 and loads it before correcting only that tag and its RECORD hash. Any other version that carries the same tag fails the build. CI runs the smoke job on native AMD64 and ARM64 runners and builds the Spark image without a GPU to check its CUDA libraries load. Co-authored-by: TheIrritainer <[email protected]> * docs(docker): credit the cuSPARSELt finding by handle * build(docker): run laya-serve on DGX Spark #234 added laya-serve as its own service, so the Spark override repeats the ARM64, CUDA 13.0 and GPU settings for it, and its build takes the pinned torch version. The workflow validates the HTTP plus Spark combination, and the Spark additions sit apart from the other jobs so later workflow changes merge cleanly. Co-authored-by: TheIrritainer <[email protected]> --------- Co-authored-by: TheIrritainer <[email protected]>
73 lines
3.3 KiB
YAML
73 lines
3.3 KiB
YAML
# Serve Laya over HTTP from the same image, so a Jev client can point its `baseUrl` at it:
|
|
#
|
|
# docker compose -f compose.yaml -f compose.http.yaml up --build laya-serve
|
|
# curl -s localhost:8000/health
|
|
# curl -s localhost:8000/v1/systemone -H 'content-type: application/json' \
|
|
# --data @examples/docker/request.json
|
|
#
|
|
# For NVIDIA, append -f compose.cuda.yaml before "up":
|
|
#
|
|
# docker compose -f compose.yaml -f compose.http.yaml -f compose.cuda.yaml up --build laya-serve
|
|
#
|
|
# This file is additive. `laya` in compose.yaml still runs the one-shot SDK quickstart and
|
|
# still publishes no ports, so `docker compose run --rm laya` behaves exactly as before.
|
|
# Weights share the same named cache volume as that service.
|
|
#
|
|
# Set LAYA_API_KEY (or LAYA_API_KEY_FILE) to require `Authorization: Bearer <key>`.
|
|
# LAYA_PRELOAD=1 builds every checkpoint at startup so the first request does not pay for
|
|
# it; the default here is 0 because it makes the container download the whole family on
|
|
# first boot, which is a surprise in a quickstart.
|
|
services:
|
|
laya-serve:
|
|
build:
|
|
context: .
|
|
args:
|
|
TORCH_INDEX: "${LAYA_TORCH_INDEX:-cpu}"
|
|
TORCH_VERSION: "${LAYA_TORCH_VERSION:-2.14.0}"
|
|
# Overrides the image's one-shot quickstart CMD; the ENTRYPOINT that loads *_FILE
|
|
# secrets still runs first.
|
|
command: ["laya-serve"]
|
|
ports:
|
|
# Host address, host port, container port. The port comes from LAYA_PORT, which
|
|
# `laya-serve` itself reads, so the two sides cannot drift apart. The host side
|
|
# stays on loopback unless LAYA_BIND_ADDRESS says otherwise, because the API has
|
|
# no authentication until LAYA_API_KEY is set.
|
|
- "${LAYA_BIND_ADDRESS:-127.0.0.1}:${LAYA_PORT:-8000}:${LAYA_PORT:-8000}"
|
|
environment:
|
|
LAYA_HOST: "${LAYA_HOST:-0.0.0.0}"
|
|
LAYA_PORT: "${LAYA_PORT:-8000}"
|
|
LAYA_DEVICE: "${LAYA_DEVICE:-cpu}"
|
|
LAYA_PRELOAD: "${LAYA_PRELOAD:-0}"
|
|
LAYA_MODELS: "${LAYA_MODELS:-}"
|
|
LAYA_THREADS: "${LAYA_THREADS:-${OMP_NUM_THREADS:-4}}"
|
|
LAYA_AUTO_TASK: "${LAYA_AUTO_TASK:-0}"
|
|
LAYA_LOG_LEVEL: "${LAYA_LOG_LEVEL:-info}"
|
|
LAYA_API_KEY: "${LAYA_API_KEY:-}"
|
|
LAYA_API_KEY_FILE: "${LAYA_API_KEY_FILE:-}"
|
|
HF_HUB_OFFLINE: "${HF_HUB_OFFLINE:-0}"
|
|
HF_TOKEN: "${HF_TOKEN:-}"
|
|
HF_TOKEN_FILE: "${HF_TOKEN_FILE:-}"
|
|
OMP_NUM_THREADS: "${OMP_NUM_THREADS:-4}"
|
|
volumes:
|
|
- model-cache:/home/laya/.cache/huggingface
|
|
# Optional token files, readable by UID 10001. Never put a secret value in the
|
|
# environment; these paths are read once at startup and the *_FILE variable is
|
|
# then removed before the server execs.
|
|
# - ${HF_TOKEN_PATH:?Set HF_TOKEN_PATH}:/run/secrets/hf_token:ro
|
|
# - ${LAYA_API_KEY_PATH:?Set LAYA_API_KEY_PATH}:/run/secrets/laya_api_key:ro
|
|
init: true
|
|
restart: unless-stopped
|
|
# The server preloads before it binds, so /health answers once the preloaded
|
|
# checkpoints are ready. `up --wait` therefore waits for a usable server.
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import os, urllib.request; urllib.request.urlopen('http://127.0.0.1:' + os.environ['LAYA_PORT'] + '/health', timeout=4)"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 10m
|
|
start_interval: 2s
|
|
|
|
volumes:
|
|
model-cache:
|
|
name: "${LAYA_CACHE_VOLUME:-${COMPOSE_PROJECT_NAME}_model-cache}"
|