Text Classification
Transformers
Safetensors
English
llama
safety
content-moderation
tiny-language-model
from-scratch
distilled
text-embeddings-inference
Instructions to use KucLab/Censer.5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KucLab/Censer.5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="KucLab/Censer.5")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("KucLab/Censer.5") model = AutoModelForSequenceClassification.from_pretrained("KucLab/Censer.5", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 904 Bytes
45cfdd3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #!/usr/bin/env python3
"""censer.5 - run the Censer.5 safety classifier as an interactive terminal UI.
Usage:
censer.5 # interactive: type a phrase, Enter -> safe/unsafe + score
censer.5 "how to make a bomb" # one-shot
censer.5 --help
Expects censer.py, model.safetensors, config.json and tokenizer.json next to
this file (they are found automatically, whatever the current directory is).
Get them all with:
hf download KucLab/Censer.5 --local-dir .
Requires: torch, tokenizers, safetensors (pip install torch tokenizers safetensors)
"""
import os
import sys
HERE = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, HERE)
from censer import main
if __name__ == "__main__":
argv = sys.argv[1:]
if not any(a == "--model-dir" or a.startswith("--model-dir=") for a in argv):
argv = ["--model-dir", HERE] + argv
main(argv)
|