About ORPO
Collection
Contains some information and experiments fine-tuning LLMs using 🤗 `trl.ORPOTrainer` • 7 items • Updated • 5
How to use alvarobartt/mistral-orpo-mix-b0.05-l1024-pl512-lr5e-7-cosine with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="alvarobartt/mistral-orpo-mix-b0.05-l1024-pl512-lr5e-7-cosine")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("alvarobartt/mistral-orpo-mix-b0.05-l1024-pl512-lr5e-7-cosine")
model = AutoModelForCausalLM.from_pretrained("alvarobartt/mistral-orpo-mix-b0.05-l1024-pl512-lr5e-7-cosine", 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 alvarobartt/mistral-orpo-mix-b0.05-l1024-pl512-lr5e-7-cosine with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "alvarobartt/mistral-orpo-mix-b0.05-l1024-pl512-lr5e-7-cosine"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "alvarobartt/mistral-orpo-mix-b0.05-l1024-pl512-lr5e-7-cosine",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/alvarobartt/mistral-orpo-mix-b0.05-l1024-pl512-lr5e-7-cosine
How to use alvarobartt/mistral-orpo-mix-b0.05-l1024-pl512-lr5e-7-cosine with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "alvarobartt/mistral-orpo-mix-b0.05-l1024-pl512-lr5e-7-cosine" \
--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": "alvarobartt/mistral-orpo-mix-b0.05-l1024-pl512-lr5e-7-cosine",
"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 "alvarobartt/mistral-orpo-mix-b0.05-l1024-pl512-lr5e-7-cosine" \
--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": "alvarobartt/mistral-orpo-mix-b0.05-l1024-pl512-lr5e-7-cosine",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use alvarobartt/mistral-orpo-mix-b0.05-l1024-pl512-lr5e-7-cosine with Docker Model Runner:
docker model run hf.co/alvarobartt/mistral-orpo-mix-b0.05-l1024-pl512-lr5e-7-cosine
This model is a fine-tuned version of mistralai/Mistral-7B-v0.1 on the None 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 | Rewards/chosen | Rewards/rejected | Rewards/accuracies | Rewards/margins | Logps/rejected | Logps/chosen | Logits/rejected | Logits/chosen | Nll Loss | Log Odds Ratio | Log Odds Chosen |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0.9159 | 1.0 | 105 | 0.8794 | -0.0421 | -0.0499 | 0.6302 | 0.0078 | -0.9975 | -0.8413 | -2.8931 | -2.8875 | 0.8561 | -0.6429 | 0.3024 |
| 0.8397 | 2.0 | 211 | 0.8612 | -0.0404 | -0.0495 | 0.6458 | 0.0092 | -0.9902 | -0.8071 | -2.8882 | -2.8794 | 0.8366 | -0.6257 | 0.3555 |
| 0.7808 | 2.99 | 315 | 0.8648 | -0.0405 | -0.0502 | 0.6458 | 0.0097 | -1.0036 | -0.8096 | -2.9146 | -2.9040 | 0.8392 | -0.6215 | 0.3802 |
Base model
mistralai/Mistral-7B-v0.1