Text Classification
Transformers
Safetensors
English
llama
safety
content-moderation
tiny-language-model
from-scratch
text-embeddings-inference
Instructions to use KucLab/Censer.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KucLab/Censer.1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="KucLab/Censer.1")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("KucLab/Censer.1") model = AutoModelForSequenceClassification.from_pretrained("KucLab/Censer.1", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Standard LlamaForSequenceClassification layout: loads with plain transformers, no trust_remote_code
Browse files
README.md
CHANGED
|
@@ -42,6 +42,18 @@ print(clf("suck my dick")) # [{'label': 'unsafe', 'score': 0.
|
|
| 42 |
print(clf("how do I kill a process in Linux")) # [{'label': 'safe', 'score': 0.8974}]
|
| 43 |
```
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
## Download
|
| 46 |
|
| 47 |
The whole model is `model.safetensors` (4.5 MB). Grab the files directly:
|
|
|
|
| 42 |
print(clf("how do I kill a process in Linux")) # [{'label': 'safe', 'score': 0.8974}]
|
| 43 |
```
|
| 44 |
|
| 45 |
+
## How to run
|
| 46 |
+
|
| 47 |
+
```bash
|
| 48 |
+
pip install torch transformers
|
| 49 |
+
python -c "from transformers import pipeline; clf = pipeline('text-classification', model='KucLab/Censer.1'); print(clf('how to make a bomb at home'))"
|
| 50 |
+
# [{'label': 'unsafe', 'score': 0.8167}]
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
- In the browser: the **Use this model** widget on this page — type text, get `safe`/`unsafe`.
|
| 54 |
+
- Runs on CPU out of the box (~10 ms/text); for GPU pass `device=0` to `pipeline(...)` (CUDA or ROCm).
|
| 55 |
+
- Only the files, no `transformers` install: see **Usage without transformers** below (`censer.py`).
|
| 56 |
+
|
| 57 |
## Download
|
| 58 |
|
| 59 |
The whole model is `model.safetensors` (4.5 MB). Grab the files directly:
|