Instructions to use krazyjakee/gandalf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use krazyjakee/gandalf with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="krazyjakee/gandalf")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("krazyjakee/gandalf") model = AutoModelForSequenceClassification.from_pretrained("krazyjakee/gandalf", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Gandalf 0.0.16
Local policy moderation. 60.06% target attainment on the website's all-40 research benchmark. This download provides the complete Python worker for 30 semantic policies; the all-40 score also includes the project's Rust hybrid rules. The benchmark uses repeatedly exposed, model-labelled evidence; it is not a deployment reliability estimate. See the website for results and research details.
Download this repository, then run from its directory:
python3 -m pip install -r requirements.txt
echo '{"message":"Thank you for your help.","policy":"Do not threaten to injure, kill, or otherwise harm a person."}' | python3 preset_backend.py --model-path .
The worker emits a readiness record, then a JSON score. Policy wordings and frozen
thresholds are in preset.json. Keep all model assets: the worker combines the
cross-encoder, phrase models and sentence heads.
Terms
No release-wide reuse license or commercial-use clearance is granted; inherited
research and noncommercial source terms remain unresolved.
The modified DeBERTa foundation
(cross-encoder/nli-deberta-v3-xsmall)
and frozen sentence foundation
(all-MiniLM-L6-v2)
declare Apache-2.0; see BASE_MODEL_LICENSE.txt for their license.
Training provenance includes NVIDIA Aegis 2.0 (CC-BY-4.0), Vidgen et al.'s Dynamically Generated Hate Speech Dataset (2021, CC-BY-4.0), Jigsaw Toxic Comment (CC0 dataset; Wikipedia text under CC-BY-SA-3.0), Shieldstral teacher scores and project-written/model-reviewed examples. Source and teacher-output review remains incomplete.
- Downloads last month
- 6