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/Censer.8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KucLab/Censer.8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="KucLab/Censer.8")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("KucLab/Censer.8") model = AutoModelForSequenceClassification.from_pretrained("KucLab/Censer.8", device_map="auto") - Notebooks
- Google Colab
- Kaggle
censer.py: --prefer-quant flag
Browse files
censer.py
CHANGED
|
@@ -428,10 +428,12 @@ def main(argv: list[str] | None = None) -> None:
|
|
| 428 |
parser.add_argument("--model-dir", default=".")
|
| 429 |
parser.add_argument("--threshold", type=float, default=0.5)
|
| 430 |
parser.add_argument("--json", action="store_true")
|
|
|
|
|
|
|
| 431 |
parser.add_argument("--repl", action="store_true", help="interactive UI (default when no text is given)")
|
| 432 |
args = parser.parse_args(argv)
|
| 433 |
|
| 434 |
-
pipe = CenserPipeline(args.model_dir, args.threshold)
|
| 435 |
text = " ".join(args.text).strip()
|
| 436 |
if args.repl or not text:
|
| 437 |
raise SystemExit(repl(pipe))
|
|
|
|
| 428 |
parser.add_argument("--model-dir", default=".")
|
| 429 |
parser.add_argument("--threshold", type=float, default=0.5)
|
| 430 |
parser.add_argument("--json", action="store_true")
|
| 431 |
+
parser.add_argument("--prefer-quant", action="store_true",
|
| 432 |
+
help="load model_int8.safetensors (0.9 MB) instead of fp32 if present")
|
| 433 |
parser.add_argument("--repl", action="store_true", help="interactive UI (default when no text is given)")
|
| 434 |
args = parser.parse_args(argv)
|
| 435 |
|
| 436 |
+
pipe = CenserPipeline(args.model_dir, args.threshold, prefer_quant=args.prefer_quant)
|
| 437 |
text = " ".join(args.text).strip()
|
| 438 |
if args.repl or not text:
|
| 439 |
raise SystemExit(repl(pipe))
|