UOPD
Collection
Uncertainty-Aware Intervention for On-Policy Distillation of Multi-Turn Agents โข 4 items โข Updated
How to use Wenboz/UOPD-Qwen2.5-3B-Instruct-ALFWorld with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Wenboz/UOPD-Qwen2.5-3B-Instruct-ALFWorld")
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("Wenboz/UOPD-Qwen2.5-3B-Instruct-ALFWorld")
model = AutoModelForCausalLM.from_pretrained("Wenboz/UOPD-Qwen2.5-3B-Instruct-ALFWorld", 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]:]))How to use Wenboz/UOPD-Qwen2.5-3B-Instruct-ALFWorld with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Wenboz/UOPD-Qwen2.5-3B-Instruct-ALFWorld"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Wenboz/UOPD-Qwen2.5-3B-Instruct-ALFWorld",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/Wenboz/UOPD-Qwen2.5-3B-Instruct-ALFWorld
How to use Wenboz/UOPD-Qwen2.5-3B-Instruct-ALFWorld with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Wenboz/UOPD-Qwen2.5-3B-Instruct-ALFWorld" \
--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": "Wenboz/UOPD-Qwen2.5-3B-Instruct-ALFWorld",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "Wenboz/UOPD-Qwen2.5-3B-Instruct-ALFWorld" \
--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": "Wenboz/UOPD-Qwen2.5-3B-Instruct-ALFWorld",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use Wenboz/UOPD-Qwen2.5-3B-Instruct-ALFWorld with Docker Model Runner:
docker model run hf.co/Wenboz/UOPD-Qwen2.5-3B-Instruct-ALFWorld
Final UOPD student checkpoint trained on ALFWorld with the frozen teacher
langfeng01/GiGPO-Qwen2.5-7B-Instruct-ALFWorld.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "Wenboz/UOPD-Qwen2.5-3B-Instruct-ALFWorld"
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
| Setting | Value |
|---|---|
| Student initialization | Qwen/Qwen2.5-3B-Instruct |
| Teacher | langfeng01/GiGPO-Qwen2.5-7B-Instruct-ALFWorld |
| Training steps | 250 |
| Rollout / training batch | 16 / 64 |
| Environment step limit | 50 |
| Max prompt / response tokens | 2,048 / 512 |
| Optimizer | AdamW, learning rate 1e-6 |
| Target intervention rate | linear 0.30 โ 0.05 over the first 120 training steps, then 0.05 |
| Triggered-turn loss | Plain SFT, weight 1.0 |
| Teacher takeover | Enabled |