HuggingFaceH4/ultrafeedback_binarized
Viewer • Updated • 187k • 16.7k • 338
How to use tanliboy/llama-3.2-3b-dpo with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="tanliboy/llama-3.2-3b-dpo")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("tanliboy/llama-3.2-3b-dpo")
model = AutoModelForCausalLM.from_pretrained("tanliboy/llama-3.2-3b-dpo")
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=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use tanliboy/llama-3.2-3b-dpo with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "tanliboy/llama-3.2-3b-dpo"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "tanliboy/llama-3.2-3b-dpo",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/tanliboy/llama-3.2-3b-dpo
How to use tanliboy/llama-3.2-3b-dpo with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "tanliboy/llama-3.2-3b-dpo" \
--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": "tanliboy/llama-3.2-3b-dpo",
"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 "tanliboy/llama-3.2-3b-dpo" \
--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": "tanliboy/llama-3.2-3b-dpo",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use tanliboy/llama-3.2-3b-dpo with Docker Model Runner:
docker model run hf.co/tanliboy/llama-3.2-3b-dpo
This model is a fine-tuned version of tanliboy/llama-3.2-3b-sft on the HuggingFaceH4/orca_dpo_pairs and the HuggingFaceH4/ultrafeedback_binarized datasets. It achieves the following results on the evaluation set:
More information needed
More information needed
More information needed
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss | Rewards/chosen | Rewards/rejected | Rewards/accuracies | Rewards/margins | Logps/rejected | Logps/chosen | Logits/rejected | Logits/chosen |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0.5801 | 0.4739 | 100 | 0.6840 | 0.6485 | -2.9389 | 0.6899 | 3.5875 | -361.2435 | -339.3325 | 0.6783 | 0.6103 |
| 0.537 | 0.9479 | 200 | 0.6514 | 0.2045 | -4.0315 | 0.7278 | 4.2360 | -372.1696 | -343.7731 | 0.5648 | 0.4948 |
| 0.4787 | 1.4218 | 300 | 0.6387 | 0.4099 | -3.9882 | 0.7215 | 4.3981 | -371.7361 | -341.7187 | 0.5326 | 0.4589 |
| 0.4559 | 1.8957 | 400 | 0.6332 | 0.7690 | -3.6688 | 0.7342 | 4.4379 | -368.5425 | -338.1277 | 0.4841 | 0.4110 |
| 0.4028 | 2.3697 | 500 | 0.6289 | 0.7479 | -3.8379 | 0.7405 | 4.5857 | -370.2327 | -338.3392 | 0.4475 | 0.3731 |
| 0.4029 | 2.8436 | 600 | 0.6284 | 0.8504 | -3.7058 | 0.7437 | 4.5562 | -368.9125 | -337.3143 | 0.4571 | 0.3820 |