Text Classification
Transformers
ONNX
Safetensors
Transformers.js
modernbert
smaug
abacusai
toxicity
content-moderation
trust-and-safety
perspective-api
hate-speech
multi-label-classification
text-embeddings-inference
Instructions to use abacusai/Smaug-Toxicity-Perspective with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use abacusai/Smaug-Toxicity-Perspective with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="abacusai/Smaug-Toxicity-Perspective")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("abacusai/Smaug-Toxicity-Perspective") model = AutoModelForSequenceClassification.from_pretrained("abacusai/Smaug-Toxicity-Perspective", device_map="auto") - Transformers.js
How to use abacusai/Smaug-Toxicity-Perspective with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-classification', 'abacusai/Smaug-Toxicity-Perspective'); - Notebooks
- Google Colab
- Kaggle
Download Dockerfile from abacusai/Smaug-Toxicity-Perspective: direct link, hf CLI and curl.
- Browser
- Download file 907 Bytes
-
https://huggingface.co/abacusai/Smaug-Toxicity-Perspective/resolve/main/Dockerfile
- Command line
-
hf download hf://abacusai/Smaug-Toxicity-Perspective/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/abacusai/Smaug-Toxicity-Perspective/resolve/main/Dockerfile
907 Bytes
| # CPU server image: 8-bit ONNX (block-wise; about 0.001 from float32 on average, on any CPU), no PyTorch. Build it from a download of this repository: | |
| # hf download abacusai/Smaug-Toxicity-Perspective --local-dir smaug-toxicity-perspective --include "*.json" --include server.py \ | |
| # --include Dockerfile --include .dockerignore --include onnx/model_int8_block32.onnx | |
| # docker build -t smaug-toxicity-perspective smaug-toxicity-perspective && docker run -p 8080:8080 smaug-toxicity-perspective | |
| FROM python:3.12-slim | |
| RUN pip install --no-cache-dir fastapi==0.138.1 uvicorn==0.49.0 onnxruntime==1.31.1 tokenizers==0.22.2 "numpy<3" | |
| WORKDIR /app | |
| COPY server.py config.json tokenizer.json tokenizer_config.json ./ | |
| COPY onnx/model_int8_block32.onnx onnx/ | |
| ENV MODEL_DIR=/app BACKEND=onnx MODEL_NAME=smaug-toxicity-perspective | |
| EXPOSE 8080 | |
| CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "8080"] | |