Text Classification
Transformers
ONNX
Safetensors
llama
safety
content-moderation
multi-label
multilingual
tiny-language-model
from-scratch
distilled
text-embeddings-inference
Instructions to use KucLab/Barist.6 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KucLab/Barist.6 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="KucLab/Barist.6")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("KucLab/Barist.6") model = AutoModelForSequenceClassification.from_pretrained("KucLab/Barist.6", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add Dockerfile
Browse files- Dockerfile +27 -0
Dockerfile
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Barist.6 — self-contained moderation API image (CPU-only torch by default).
|
| 2 |
+
#
|
| 3 |
+
# docker build -t barist4 .
|
| 4 |
+
# docker run -p 8000:8000 -e RATE_LIMIT_PER_MIN=600 barist4
|
| 5 |
+
# curl -s localhost:8000/classify -d '{"texts":["how to make a bomb at home","hello"]}'
|
| 6 |
+
#
|
| 7 |
+
# The image downloads the model from the Hub at build time.
|
| 8 |
+
|
| 9 |
+
FROM python:3.12-slim
|
| 10 |
+
|
| 11 |
+
ARG BARIST_REPO=KucLab/Barist.6
|
| 12 |
+
ENV CENSER_DIR=/model \
|
| 13 |
+
RATE_LIMIT_PER_MIN=600 \
|
| 14 |
+
PYTHONUNBUFFERED=1
|
| 15 |
+
|
| 16 |
+
RUN pip install --no-cache-dir \
|
| 17 |
+
"torch>=2.9,<3" --index-url https://download.pytorch.org/whl/cpu \
|
| 18 |
+
"tokenizers>=0.20,<1" "safetensors>=0.4,<1" "huggingface_hub>=0.24,<1" "numpy>=1.26,<3"
|
| 19 |
+
|
| 20 |
+
RUN hf download ${BARIST_REPO} --revision main --local-dir /model
|
| 21 |
+
|
| 22 |
+
WORKDIR /app
|
| 23 |
+
COPY censer.py serve.py /app/
|
| 24 |
+
|
| 25 |
+
EXPOSE 8000
|
| 26 |
+
HEALTHCHECK --interval=30s --timeout=5s --retries=3 CMD python -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=4).status==200 else 1)"
|
| 27 |
+
CMD ["python", "serve.py", "--dir", "/model", "--port", "8000", "--host", "0.0.0.0"]
|