Text Generation
Transformers
Safetensors
qwen3
safety
guard-model
policy-conditioned
agent-safety
reinforcement-learning
conversational
text-generation-inference
Instructions to use Yunhao-Feng/AdaGuard-0.6B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Yunhao-Feng/AdaGuard-0.6B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Yunhao-Feng/AdaGuard-0.6B") 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-0.6B") model = AutoModelForCausalLM.from_pretrained("Yunhao-Feng/AdaGuard-0.6B", 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-0.6B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Yunhao-Feng/AdaGuard-0.6B" # 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-0.6B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Yunhao-Feng/AdaGuard-0.6B
- SGLang
How to use Yunhao-Feng/AdaGuard-0.6B 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-0.6B" \ --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-0.6B", "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-0.6B" \ --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-0.6B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Yunhao-Feng/AdaGuard-0.6B with Docker Model Runner:
docker model run hf.co/Yunhao-Feng/AdaGuard-0.6B
Download evaluation_results.json from Yunhao-Feng/AdaGuard-0.6B: direct link, hf CLI and curl.
- Browser
- Download file 1.54 kB
-
https://huggingface.co/Yunhao-Feng/AdaGuard-0.6B/resolve/main/evaluation_results.json
- Command line
-
hf download hf://Yunhao-Feng/AdaGuard-0.6B/evaluation_results.json
-
curl -L -o evaluation_results.json https://huggingface.co/Yunhao-Feng/AdaGuard-0.6B/resolve/main/evaluation_results.json
1.54 kB
| { | |
| "schema_version": 1, | |
| "model_id": "Yunhao-Feng/AdaGuard-0.6B", | |
| "units": "percent", | |
| "result_type": "previously_reported_single_run", | |
| "release_validation_is_benchmark_rerun": false, | |
| "datasets": { | |
| "AdaptiveSafety": { | |
| "samples": 1000, | |
| "compliant": 500, | |
| "violating": 500, | |
| "binary": { | |
| "accuracy": 82.6, | |
| "precision": 90.55, | |
| "recall": 72.8, | |
| "f1": 80.71 | |
| }, | |
| "rule_identification": { | |
| "exact_match": 68.1, | |
| "micro_precision": 71.73, | |
| "micro_recall": 50.51, | |
| "micro_f1": 59.28 | |
| } | |
| }, | |
| "DynaBench": { | |
| "samples": 543, | |
| "compliant": 276, | |
| "violating": 267, | |
| "binary": { | |
| "accuracy": 51.38, | |
| "precision": 50.37, | |
| "recall": 76.4, | |
| "f1": 60.71 | |
| }, | |
| "rule_identification": { | |
| "exact_match": 44.94, | |
| "micro_precision": 40.78, | |
| "micro_recall": 66.29, | |
| "micro_f1": 50.5 | |
| } | |
| } | |
| }, | |
| "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" | |
| } | |
| } | |