TinyLlama RLHF Models
Collection
6 items • Updated
How to use AIPlans/TinyLlama-1.1B-IPO-PKU-SafeRLHF with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="AIPlans/TinyLlama-1.1B-IPO-PKU-SafeRLHF")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("AIPlans/TinyLlama-1.1B-IPO-PKU-SafeRLHF")
model = AutoModelForCausalLM.from_pretrained("AIPlans/TinyLlama-1.1B-IPO-PKU-SafeRLHF", 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 AIPlans/TinyLlama-1.1B-IPO-PKU-SafeRLHF with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "AIPlans/TinyLlama-1.1B-IPO-PKU-SafeRLHF"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "AIPlans/TinyLlama-1.1B-IPO-PKU-SafeRLHF",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/AIPlans/TinyLlama-1.1B-IPO-PKU-SafeRLHF
How to use AIPlans/TinyLlama-1.1B-IPO-PKU-SafeRLHF with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "AIPlans/TinyLlama-1.1B-IPO-PKU-SafeRLHF" \
--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": "AIPlans/TinyLlama-1.1B-IPO-PKU-SafeRLHF",
"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 "AIPlans/TinyLlama-1.1B-IPO-PKU-SafeRLHF" \
--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": "AIPlans/TinyLlama-1.1B-IPO-PKU-SafeRLHF",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use AIPlans/TinyLlama-1.1B-IPO-PKU-SafeRLHF with Docker Model Runner:
docker model run hf.co/AIPlans/TinyLlama-1.1B-IPO-PKU-SafeRLHF
docker model run hf.co/AIPlans/TinyLlama-1.1B-IPO-PKU-SafeRLHFThis model is a fine-tuned version of TinyLlama/TinyLlama-1.1B-Chat-v1.0 on an unknown 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 24.8672 | 0.0960 | 200 | 24.8184 | -0.0031 | -0.0050 | 0.7069 | 0.0018 | -2.0534 | -2.0334 | -2.7185 | -2.8480 |
| 24.1359 | 0.1920 | 400 | 24.2118 | -0.0132 | -0.0215 | 0.7351 | 0.0083 | -2.2183 | -2.1337 | -2.6542 | -2.7800 |
| 22.6582 | 0.2880 | 600 | 22.9068 | -0.0523 | -0.0760 | 0.7280 | 0.0237 | -2.7638 | -2.5252 | -2.4992 | -2.6281 |
| 21.2405 | 0.3840 | 800 | 19.5980 | -0.2860 | -0.3895 | 0.7207 | 0.1036 | -5.8987 | -4.8616 | -2.3572 | -2.4838 |
| 16.8004 | 0.4800 | 1000 | 18.8829 | -0.3386 | -0.4676 | 0.7299 | 0.1290 | -6.6800 | -5.3883 | -2.2910 | -2.4227 |
| 20.9951 | 0.5760 | 1200 | 18.5470 | -0.3274 | -0.4552 | 0.7343 | 0.1279 | -6.5555 | -5.2756 | -2.2822 | -2.4138 |
| 19.3603 | 0.6719 | 1400 | 18.4526 | -0.3367 | -0.4669 | 0.7367 | 0.1303 | -6.6729 | -5.3688 | -2.2770 | -2.4091 |
| 16.8747 | 0.7679 | 1600 | 18.4182 | -0.3410 | -0.4724 | 0.7383 | 0.1314 | -6.7270 | -5.4120 | -2.2717 | -2.4042 |
| 20.3795 | 0.8639 | 1800 | 18.4132 | -0.3418 | -0.4733 | 0.7370 | 0.1315 | -6.7369 | -5.4201 | -2.2711 | -2.4037 |
| 18.8851 | 0.9599 | 2000 | 18.4097 | -0.3421 | -0.4737 | 0.7381 | 0.1316 | -6.7404 | -5.4228 | -2.2713 | -2.4037 |
Base model
TinyLlama/TinyLlama-1.1B-Chat-v1.0
Install from pip and serve model
# Install vLLM from pip: pip install vllm# Start the vLLM server: vllm serve "AIPlans/TinyLlama-1.1B-IPO-PKU-SafeRLHF"# Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AIPlans/TinyLlama-1.1B-IPO-PKU-SafeRLHF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'