HuggingFaceH4/ultrafeedback_binarized
Viewer • Updated • 187k • 15.3k • 335
How to use sail/Llama-3-Base-8B-DICE-Iter2 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="sail/Llama-3-Base-8B-DICE-Iter2")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("sail/Llama-3-Base-8B-DICE-Iter2")
model = AutoModelForCausalLM.from_pretrained("sail/Llama-3-Base-8B-DICE-Iter2")
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 sail/Llama-3-Base-8B-DICE-Iter2 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "sail/Llama-3-Base-8B-DICE-Iter2"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "sail/Llama-3-Base-8B-DICE-Iter2",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/sail/Llama-3-Base-8B-DICE-Iter2
How to use sail/Llama-3-Base-8B-DICE-Iter2 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "sail/Llama-3-Base-8B-DICE-Iter2" \
--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": "sail/Llama-3-Base-8B-DICE-Iter2",
"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 "sail/Llama-3-Base-8B-DICE-Iter2" \
--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": "sail/Llama-3-Base-8B-DICE-Iter2",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use sail/Llama-3-Base-8B-DICE-Iter2 with Docker Model Runner:
docker model run hf.co/sail/Llama-3-Base-8B-DICE-Iter2
This model was developed using Bootstrapping Language Models with DPO Implicit Rewards (DICE) at iteration 2, based on the princeton-nlp/Llama-3-Base-8B-SFT-DPO architecture as the starting point.
| Model | LC. Win Rate | Win Rate |
|---|---|---|
| Llama-3-Base-8B-SFT-DPO | 18.20 | 15.50 |
| Llama-3-Base-8B-DICE-Iter1 | 25.08 | 25.77 |
| Llama-3-Base-8B-DICE-Iter2 | 27.55 | 30.99 |
https://github.com/sail-sg/dice
@article{chen2024bootstrapping,
title={Bootstrapping Language Models with DPO Implicit Rewards},
author={Chen, Changyu and Liu, Zichen and Du, Chao and Pang, Tianyu and Liu, Qian and Sinha, Arunesh and Varakantham, Pradeep and Lin, Min},
journal={arXiv preprint arXiv:2406.09760},
year={2024}
}