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
File size: 2,203 Bytes
41a51b7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <svg xmlns="http://www.w3.org/2000/svg" width="1200" height="400" viewBox="0 0 1200 400" role="img" aria-labelledby="title desc">
<title id="title">AdaGuard 8B: Your policies. Clear explanations. Rule-level verdicts.</title>
<desc id="desc">Policy and interaction are evaluated by AdaGuard to produce an analysis and violated rule IDs.</desc>
<defs><linearGradient id="bg" x2="1" y2="1"><stop stop-color="#081B3A"/><stop offset="1" stop-color="#143B6F"/></linearGradient></defs>
<rect width="1200" height="400" rx="24" fill="url(#bg)"/>
<path d="M880 0L1200 320M990 0L1200 210M1100 0L1200 100" stroke="#275082" stroke-width="1"/>
<g font-family="Arial, Helvetica, sans-serif">
<text x="56" y="54" fill="#83BAFF" font-size="15" letter-spacing="3">POLICY-CONDITIONED GUARD MODELS</text>
<text x="56" y="130" fill="white" font-size="61" font-weight="700">AdaGuard</text>
<rect x="402" y="82" width="116" height="53" rx="14" fill="#2563EB"/>
<text x="460" y="118" fill="white" font-size="28" font-weight="700" text-anchor="middle">8B</text>
<text x="56" y="181" fill="#E1EDFF" font-size="25">Your policies. Clear explanations. Rule-level verdicts.</text>
<text x="56" y="217" fill="#A7C4E7" font-size="18">Assess user requests and agent trajectories under the rules you define.</text>
<rect x="56" y="265" width="307" height="79" rx="14" fill="#FFFFFF" fill-opacity="0.07" stroke="#49709B"/>
<text x="80" y="294" fill="#93C5FD" font-size="12" letter-spacing="2">INPUT</text>
<text x="80" y="324" fill="white" font-size="21">Policy + Interaction</text>
<path d="M381 305H426M416 295L426 305L416 315" fill="none" stroke="#7EADDF" stroke-width="2"/>
<rect x="445" y="265" width="219" height="79" rx="14" fill="#2563EB"/>
<text x="554" y="314" fill="white" font-size="26" font-weight="700" text-anchor="middle">AdaGuard</text>
<path d="M683 305H729M719 295L729 305L719 315" fill="none" stroke="#7EADDF" stroke-width="2"/>
<rect x="748" y="265" width="396" height="79" rx="14" fill="#FFFFFF" fill-opacity="0.07" stroke="#49709B"/>
<text x="772" y="294" fill="#93C5FD" font-size="12" letter-spacing="2">OUTPUT</text>
<text x="772" y="324" fill="white" font-size="21">Analysis + Violated Rule IDs</text>
</g></svg> |