webis/tldr-17
Viewer • Updated • 1.33M • 1.1k • 56
How to use jiazhengli/Pythia-2.8B-TLDR-Iterative-SamPO with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="jiazhengli/Pythia-2.8B-TLDR-Iterative-SamPO") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("jiazhengli/Pythia-2.8B-TLDR-Iterative-SamPO")
model = AutoModelForCausalLM.from_pretrained("jiazhengli/Pythia-2.8B-TLDR-Iterative-SamPO")How to use jiazhengli/Pythia-2.8B-TLDR-Iterative-SamPO with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "jiazhengli/Pythia-2.8B-TLDR-Iterative-SamPO"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "jiazhengli/Pythia-2.8B-TLDR-Iterative-SamPO",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/jiazhengli/Pythia-2.8B-TLDR-Iterative-SamPO
How to use jiazhengli/Pythia-2.8B-TLDR-Iterative-SamPO with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "jiazhengli/Pythia-2.8B-TLDR-Iterative-SamPO" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "jiazhengli/Pythia-2.8B-TLDR-Iterative-SamPO",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "jiazhengli/Pythia-2.8B-TLDR-Iterative-SamPO" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "jiazhengli/Pythia-2.8B-TLDR-Iterative-SamPO",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use jiazhengli/Pythia-2.8B-TLDR-Iterative-SamPO with Docker Model Runner:
docker model run hf.co/jiazhengli/Pythia-2.8B-TLDR-Iterative-SamPO
This repository provides a fine-tuned version of Pythia-2.8B, using our proposed SamPO algorithm: Eliminating Biased Length Reliance of Direct Preference Optimization via Down-Sampled KL Divergence.
| vs. SFT | wins | len / token |
|---|---|---|
| DPO | 60.98 | 53.8 |
| Iterative DPO | 73.58 | 66.65 |
| Length Normed DPO | 58.13 | 47.34 |
| SimPO | 33.33 | 31.9 |
| Iterative SamPO | 73.58 | 49.54 |
We test our model with the same GPT-4 Win rate prompt template proposed by the DPO paper. The sampled test set is included in this repo.
The following hyperparameters were used during DPO/SamPO training: