Text Classification
Transformers
Safetensors
Chinese
spam-detection
advertising-detection
ad-classification
chinese
modernbert
mmbert
multi-task
four-head
Instructions to use x6nux/laya-ad with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use x6nux/laya-ad with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="x6nux/laya-ad")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("x6nux/laya-ad", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download code/laya-server/Dockerfile from x6nux/laya-ad: direct link, hf CLI and curl.
- Browser
- Download file 1.35 kB
-
https://huggingface.co/x6nux/laya-ad/resolve/main/code/laya-server/Dockerfile
- Command line
-
hf download hf://x6nux/laya-ad/code/laya-server/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/x6nux/laya-ad/resolve/main/code/laya-server/Dockerfile
1.35 kB
| # syntax=docker/dockerfile:1 | |
| FROM node:24-bookworm-slim AS frontend-build | |
| WORKDIR /app/frontend | |
| RUN npm install -g pnpm@11.19.0 | |
| COPY frontend/package.json frontend/pnpm-lock.yaml frontend/pnpm-workspace.yaml ./ | |
| RUN CI=true pnpm install --frozen-lockfile | |
| COPY frontend/ ./ | |
| RUN CI=true pnpm build | |
| # 单镜像、不带模型权重:启动时从 Hugging Face 拉取(支持 hf-mirror 等镜像站) | |
| FROM python:3.12-slim AS app | |
| ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 \ | |
| LAYA_DATABASE_PATH=/data/laya.sqlite3 \ | |
| LAYA_FRONTEND_DIR=/app/frontend/dist \ | |
| LAYA_MODEL_DIR=/data/models/ad-clf | |
| WORKDIR /app | |
| RUN pip install --no-cache-dir torch==2.11.0 --index-url https://download.pytorch.org/whl/cpu | |
| RUN pip install --no-cache-dir transformers==5.20.2 "safetensors>=0.6.0" | |
| COPY backend/ /app/backend/ | |
| RUN pip install --no-cache-dir --no-deps /app/backend && \ | |
| pip install --no-cache-dir fastapi==0.141.1 uvicorn==0.53.0 argon2-cffi==25.1.0 pydantic==2.13.5 | |
| COPY scripts/entrypoint.py /app/scripts/entrypoint.py | |
| COPY --from=frontend-build /app/frontend/dist/ /app/frontend/dist/ | |
| RUN mkdir -p /data | |
| EXPOSE 8080 | |
| HEALTHCHECK --interval=30s --timeout=5s --start-period=300s CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/live', timeout=3)" || exit 1 | |
| CMD ["python", "scripts/entrypoint.py"] | |