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
censer.1
CHANGED
|
@@ -7,7 +7,8 @@ Usage:
|
|
| 7 |
censer.1 --help
|
| 8 |
|
| 9 |
Expects censer.py, model.safetensors, config.json and tokenizer.json next to
|
| 10 |
-
this file
|
|
|
|
| 11 |
|
| 12 |
hf download KucLab/Censer.1 --local-dir .
|
| 13 |
|
|
@@ -17,9 +18,13 @@ Requires: torch, tokenizers, safetensors (pip install torch tokenizers safetens
|
|
| 17 |
import os
|
| 18 |
import sys
|
| 19 |
|
| 20 |
-
|
|
|
|
| 21 |
|
| 22 |
from censer import main
|
| 23 |
|
| 24 |
if __name__ == "__main__":
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
censer.1 --help
|
| 8 |
|
| 9 |
Expects censer.py, model.safetensors, config.json and tokenizer.json next to
|
| 10 |
+
this file (they are found automatically, whatever the current directory is).
|
| 11 |
+
Get them all with:
|
| 12 |
|
| 13 |
hf download KucLab/Censer.1 --local-dir .
|
| 14 |
|
|
|
|
| 18 |
import os
|
| 19 |
import sys
|
| 20 |
|
| 21 |
+
HERE = os.path.dirname(os.path.abspath(__file__))
|
| 22 |
+
sys.path.insert(0, HERE)
|
| 23 |
|
| 24 |
from censer import main
|
| 25 |
|
| 26 |
if __name__ == "__main__":
|
| 27 |
+
argv = sys.argv[1:]
|
| 28 |
+
if not any(a == "--model-dir" or a.startswith("--model-dir=") for a in argv):
|
| 29 |
+
argv = ["--model-dir", HERE] + argv
|
| 30 |
+
main(argv)
|