Download Dockerfile from yanng404/laya-api: direct link, hf CLI and curl.
- Browser
- Download file 1.67 kB
-
https://huggingface.co/spaces/yanng404/laya-api/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/yanng404/laya-api/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/yanng404/laya-api/resolve/main/Dockerfile
1.67 kB
| # Inference backend for the hosted Laya API (platform/api-platform), as a | |
| # Hugging Face Docker Space on CPU Upgrade hardware (8 vCPU, 32 GB). | |
| # Runs upstream `laya-serve` (Jev-compatible POST /v1/systemone and | |
| # /v1/systemone/batch). The same image runs on T4 hardware: set the Space | |
| # variable LAYA_DEVICE=cuda after switching. | |
| FROM python:3.11-slim | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| HF_HOME=/home/user/.cache/huggingface \ | |
| USE_TF=0 \ | |
| PIP_NO_CACHE_DIR=1 | |
| WORKDIR /home/user/app | |
| # CPU-only PyTorch first, so laya does not pull the large CUDA build. | |
| # For T4 hardware, drop the --index-url so the CUDA build is installed. | |
| # 0.3.22+ is needed for /v1/systemone/batch; 0.3.24 fixes its usage totals. | |
| RUN pip install --user --index-url https://download.pytorch.org/whl/cpu torch \ | |
| && pip install --user "laya[serve]==0.4.22" | |
| # Bake all three checkpoints (~2.3 GB) into the image, so a restart serves | |
| # immediately instead of downloading first. The API exposes all three. | |
| RUN python -c "import laya; \ | |
| laya.load('convaiinnovations/laya'); \ | |
| laya.load('convaiinnovations/laya', subfolder='multilingual'); \ | |
| laya.load('convaiinnovations/laya', subfolder='typed-decisions')" | |
| # LAYA_THREADS: torch threads per request. Start at 4 (the physical cores | |
| # behind 8 vCPUs) and compare with 8 using platform/api-platform/scripts/ | |
| # bench-upstream.mjs; override it as a Space variable without rebuilding. | |
| ENV LAYA_HOST=0.0.0.0 \ | |
| LAYA_PORT=7860 \ | |
| LAYA_DEVICE=cpu \ | |
| LAYA_PRELOAD=1 \ | |
| LAYA_MODELS=english,multilingual,typed-decisions \ | |
| LAYA_THREADS=4 | |
| EXPOSE 7860 | |
| CMD ["laya-serve"] | |