Views
No views yet
/classify endpoint/v1/modelsuv run vf-install reward-model-env1import verifiers as vf
2
3# Load the environment
4vf_env = vf.load_environment(
5 "reward-model-env",
6 dataset_name="gsm8k", # HF dataset with 'prompt' or 'question' column
7 dataset_config="main", # Optional: dataset config name (required for some datasets)
8 reward_model_url="http://localhost:8002", # URL where your reward model is hosted
9 tokenizer_path="./tokenizer.json", # Optional: path to tokenizer for chat template
10 num_train_examples=100, # Optional: limit training examples
11)
12
13# Evaluate with an OpenAI-compatible model
14from openai import AsyncOpenAI
15
16results = await vf_env.evaluate(
17 client=AsyncOpenAI(base_url="http://localhost:8000/v1"),
18 model="your-model",
19 num_examples=10,
20 rollouts_per_example=1,
21)example.py for a complete working example.REWARD_MODEL_URL to avoid passing it as an argument:export REWARD_MODEL_URL="http://localhost:8002"1# Start vLLM with a reward model
2vllm serve Skywork/Skywork-Reward-Llama-3.1-8B-v0.2 \
3 --port 8002 \
4 --enable-classification/v1/models (GET)1{
2 "data": [
3 {"id": "Skywork/Skywork-Reward-Llama-3.1-8B-v0.2"}
4 ]
5}/classify (POST)1{
2 "model": "Skywork/Skywork-Reward-Llama-3.1-8B-v0.2",
3 "input": [
4 "<s>[INST]question[/INST]answer</s>"
5 ]
6}1{
2 "data": [
3 {
4 "index": 0,
5 "label": "LABEL_0",
6 "probs": [0.85],
7 "num_classes": 1
8 }
9 ]
10}probs[0] value is used as the reward.1# Input conversation
2[
3 {"role": "user", "content": "lets do python coding"},
4 {"role": "assistant", "content": "Sure! How'd you like to get started?"}
5]
6
7# Formatted output (using Llama-style template)
8"<s>[INST]lets do python coding[/INST]Sure! How'd you like to get started?</s>"tokenizer_path, it will use the tokenizer's native chat template. Otherwise, it falls back to a simple Llama-style format.dataset_name (str): Hugging Face dataset namereward_model_url (str): Base URL for the reward model APIdataset_config (str | None): Dataset config name (e.g., "main" for gsm8k, optional)tokenizer_path (str | None): Path to tokenizer.json for chat template formattingsystem_prompt (str): System prompt for the environment (default: "You are a helpful assistant.")num_train_examples (int): Number of training examples (-1 for all)num_eval_examples (int): Number of eval examples (-1 for all)max_retries (int): Maximum retry attempts for API calls (default: 3)retry_delay (float): Base delay between retries in seconds (default: 1.0)timeout (float): Request timeout in seconds (default: 120.0)vf-rl for reinforcement learning:1# configs/rl/reward_model.toml
2model = "Qwen/Qwen3-4B-Instruct-2507"
3
4[env]
5id = "reward-model-env"
6reward_model_url = "http://localhost:8002"
7dataset_name = "your-dataset"
8tokenizer_path = "./tokenizer.json"
9
10[inference]
11gpus = 1
12
13[trainer]
14gpus = 1
15use_lora = true
16learning_rate = 1e-5
17max_steps = 100uv run vf-rl @ configs/rl/reward_model.toml/v1/models endpoint returns valid data