Anthropic/hh-rlhf
Viewer • Updated • 169k • 34.9k • 2.28k
How to use jackf857/llama-3-8b-base-margin-dpo-hh-helpful-batch-64 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="jackf857/llama-3-8b-base-margin-dpo-hh-helpful-batch-64")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("jackf857/llama-3-8b-base-margin-dpo-hh-helpful-batch-64")
model = AutoModelForCausalLM.from_pretrained("jackf857/llama-3-8b-base-margin-dpo-hh-helpful-batch-64", 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=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use jackf857/llama-3-8b-base-margin-dpo-hh-helpful-batch-64 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "jackf857/llama-3-8b-base-margin-dpo-hh-helpful-batch-64"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "jackf857/llama-3-8b-base-margin-dpo-hh-helpful-batch-64",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/jackf857/llama-3-8b-base-margin-dpo-hh-helpful-batch-64
How to use jackf857/llama-3-8b-base-margin-dpo-hh-helpful-batch-64 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "jackf857/llama-3-8b-base-margin-dpo-hh-helpful-batch-64" \
--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": "jackf857/llama-3-8b-base-margin-dpo-hh-helpful-batch-64",
"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 "jackf857/llama-3-8b-base-margin-dpo-hh-helpful-batch-64" \
--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": "jackf857/llama-3-8b-base-margin-dpo-hh-helpful-batch-64",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use jackf857/llama-3-8b-base-margin-dpo-hh-helpful-batch-64 with Docker Model Runner:
docker model run hf.co/jackf857/llama-3-8b-base-margin-dpo-hh-helpful-batch-64
This model is a fine-tuned version of W-61/llama-3-8b-base-sft-hh-helpful-4xh200 on the Anthropic/hh-rlhf dataset. 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 | Margin Dpo/beta | Margin Dpo/loss Margin Mean | Margin Dpo/beta Margin Mean | Margin Dpo/beta Margin Grad Mean | Margin Dpo/beta Margin Grad Std | Margin Dpo/margin Mean | Margin Dpo/margin Std | Logps/chosen | Logps/rejected | Logps/ref Chosen | Logps/ref Rejected | Logits/chosen | Logits/rejected |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0.9037 | 0.1468 | 100 | 0.5593 | 0.1000 | 8.4400 | 0.8440 | -0.3668 | 0.2303 | 8.4400 | 15.3426 | -87.1427 | -103.3296 | -79.0510 | -86.7979 | -0.6628 | -0.6366 |
| 0.6607 | 0.2937 | 200 | 0.4791 | 0.1000 | 14.6826 | 1.4683 | -0.3109 | 0.2473 | 14.6826 | 21.1628 | -92.9979 | -115.4274 | -79.0510 | -86.7979 | -0.6426 | -0.6197 |
| 0.699 | 0.4405 | 300 | 0.4414 | 0.1000 | 18.1032 | 1.8103 | -0.2828 | 0.2516 | 18.1032 | 23.7825 | -99.9692 | -125.8193 | -79.0510 | -86.7979 | -0.6107 | -0.5845 |
| 0.4468 | 0.5874 | 400 | 0.4213 | 0.1000 | 20.2783 | 2.0278 | -0.2687 | 0.2540 | 20.2783 | 25.4582 | -102.0468 | -130.0720 | -79.0510 | -86.7979 | -0.5647 | -0.5335 |
| 0.38 | 0.7342 | 500 | 0.4098 | 0.1000 | 21.8238 | 2.1824 | -0.2579 | 0.2561 | 21.8238 | 26.5974 | -106.9358 | -136.5065 | -79.0510 | -86.7979 | -0.6236 | -0.5976 |
| 0.4876 | 0.8811 | 600 | 0.4046 | 0.1000 | 21.7563 | 2.1756 | -0.2570 | 0.2538 | 21.7563 | 26.3378 | -105.9372 | -135.4405 | -79.0510 | -86.7979 | -0.6270 | -0.6013 |
Base model
meta-llama/Meta-Llama-3-8B