Text Generation
Transformers
Safetensors
qwen3
safety
guard-model
policy-conditioned
agent-safety
reinforcement-learning
conversational
text-generation-inference
Instructions to use Yunhao-Feng/AdaGuard-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Yunhao-Feng/AdaGuard-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Yunhao-Feng/AdaGuard-8B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Yunhao-Feng/AdaGuard-8B") model = AutoModelForCausalLM.from_pretrained("Yunhao-Feng/AdaGuard-8B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Yunhao-Feng/AdaGuard-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Yunhao-Feng/AdaGuard-8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Yunhao-Feng/AdaGuard-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Yunhao-Feng/AdaGuard-8B
- SGLang
How to use Yunhao-Feng/AdaGuard-8B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Yunhao-Feng/AdaGuard-8B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Yunhao-Feng/AdaGuard-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Yunhao-Feng/AdaGuard-8B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Yunhao-Feng/AdaGuard-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Yunhao-Feng/AdaGuard-8B with Docker Model Runner:
docker model run hf.co/Yunhao-Feng/AdaGuard-8B
Download evaluation_results.json from Yunhao-Feng/AdaGuard-8B: direct link, hf CLI and curl.
- Browser
- Download file 1.54 kB
-
https://huggingface.co/Yunhao-Feng/AdaGuard-8B/resolve/main/evaluation_results.json
- Command line
-
hf download hf://Yunhao-Feng/AdaGuard-8B/evaluation_results.json
-
curl -L -o evaluation_results.json https://huggingface.co/Yunhao-Feng/AdaGuard-8B/resolve/main/evaluation_results.json
1.54 kB
| { | |
| "schema_version": 1, | |
| "model_id": "Yunhao-Feng/AdaGuard-8B", | |
| "units": "percent", | |
| "result_type": "previously_reported_single_run", | |
| "release_validation_is_benchmark_rerun": false, | |
| "datasets": { | |
| "AdaptiveSafety": { | |
| "samples": 1000, | |
| "compliant": 500, | |
| "violating": 500, | |
| "binary": { | |
| "accuracy": 89.5, | |
| "precision": 96.25, | |
| "recall": 82.2, | |
| "f1": 88.67 | |
| }, | |
| "rule_identification": { | |
| "exact_match": 77.1, | |
| "micro_precision": 85.01, | |
| "micro_recall": 65.59, | |
| "micro_f1": 74.05 | |
| } | |
| }, | |
| "DynaBench": { | |
| "samples": 543, | |
| "compliant": 276, | |
| "violating": 267, | |
| "binary": { | |
| "accuracy": 76.8, | |
| "precision": 77.22, | |
| "recall": 74.91, | |
| "f1": 76.05 | |
| }, | |
| "rule_identification": { | |
| "exact_match": 70.72, | |
| "micro_precision": 61.11, | |
| "micro_recall": 65.92, | |
| "micro_f1": 63.42 | |
| } | |
| } | |
| }, | |
| "protocol": { | |
| "inference_dtype": "bfloat16", | |
| "decoding": "greedy", | |
| "prompt_budget_tokens": 16000, | |
| "max_new_tokens": 512, | |
| "hardware": "8 x NVIDIA A100-SXM4-80GB; one model replica per GPU", | |
| "input_truncation_recorded": false, | |
| "binary_positive_class": "violation", | |
| "invalid_binary": "counted as an error", | |
| "invalid_exact_match": "never credited", | |
| "invalid_rule_micro": "empty predicted rule set; gold violations remain false negatives", | |
| "rule_order": "same order as supplied policy; incorrect ordering is invalid" | |
| } | |
| } | |