Text Generation
Transformers
Safetensors
English
Chinese
qwen2
qwen2.5
dpo
human-like
conversational
text-generation-inference
Instructions to use ruijiewang45401/qwen2.5-7b-humanlike-dpo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ruijiewang45401/qwen2.5-7b-humanlike-dpo with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ruijiewang45401/qwen2.5-7b-humanlike-dpo") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ruijiewang45401/qwen2.5-7b-humanlike-dpo") model = AutoModelForCausalLM.from_pretrained("ruijiewang45401/qwen2.5-7b-humanlike-dpo", 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ruijiewang45401/qwen2.5-7b-humanlike-dpo with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ruijiewang45401/qwen2.5-7b-humanlike-dpo" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ruijiewang45401/qwen2.5-7b-humanlike-dpo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ruijiewang45401/qwen2.5-7b-humanlike-dpo
- SGLang
How to use ruijiewang45401/qwen2.5-7b-humanlike-dpo with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ruijiewang45401/qwen2.5-7b-humanlike-dpo" \ --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": "ruijiewang45401/qwen2.5-7b-humanlike-dpo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
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 "ruijiewang45401/qwen2.5-7b-humanlike-dpo" \ --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": "ruijiewang45401/qwen2.5-7b-humanlike-dpo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ruijiewang45401/qwen2.5-7b-humanlike-dpo with Docker Model Runner:
docker model run hf.co/ruijiewang45401/qwen2.5-7b-humanlike-dpo
Qwen2.5-7B Human-like DPO
Fine-tuned Qwen2.5-7B-Instruct with DPO for more natural, empathetic conversations.
π Quick Start
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model = AutoModelForCausalLM.from_pretrained(
"ruijiewang45401/qwen2.5-7b-humanlike-dpo",
torch_dtype=torch.bfloat16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("ruijiewang45401/qwen2.5-7b-humanlike-dpo")
messages = [
{"role": "system", "content": "You are a warm and helpful assistant."},
{"role": "user", "content": "Hello!"}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to("cuda")
outputs = model.generate(
**inputs,
max_new_tokens=200,
temperature=0.8,
top_p=0.9,
do_sample=True
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
π Training Details
- Base Model: Qwen2.5-7B-Instruct
- Method: DPO with LoRA (r=16, alpha=32)
- Dataset: HumanLLMs/Human-Like-DPO-Dataset
- Training Samples: 10,339
- Hardware: NVIDIA A100 40GB
- Training Time: ~1.5 hours
Hyperparameters
| Parameter | Value |
|---|---|
| Beta | 0.1 |
| Learning Rate | 5e-5 |
| Batch Size | 2 Γ 8 |
| Max Length | 1024 |
| Epochs | 1 |
| Optimizer | AdamW |
| Scheduler | Cosine |
Results
- Rewards/Margins: 6.87
- Accuracy: 1.0
- Val Loss: ~0.00003
π‘ Generation Parameters
model.generate(
**inputs,
max_new_tokens=150-300,
temperature=0.7-0.9, # Higher = more natural
top_p=0.9,
repetition_penalty=1.1,
do_sample=True
)
π Citation
@misc{qwen25-humanlike-dpo,
author = {ruijiewang45401},
title = {Qwen2.5-7B Human-like DPO},
year = {2025},
publisher = {Hugging Face},
url = {https://huggingface.co/ruijiewang45401/qwen2.5-7b-humanlike-dpo}
}
π Credits
- Downloads last month
- 6
docker model run hf.co/ruijiewang45401/qwen2.5-7b-humanlike-dpo