u-10bei/dpo-dataset-qwen-cot
Viewer • Updated • 4.04k • 23 • 2
How to use makotonlo/LLM2026_DPO_finalv5 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="makotonlo/LLM2026_DPO_finalv5")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # pip install -U transformers accelerate
# Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("makotonlo/LLM2026_DPO_finalv5", device_map="auto")How to use makotonlo/LLM2026_DPO_finalv5 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "makotonlo/LLM2026_DPO_finalv5"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "makotonlo/LLM2026_DPO_finalv5",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/makotonlo/LLM2026_DPO_finalv5
How to use makotonlo/LLM2026_DPO_finalv5 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "makotonlo/LLM2026_DPO_finalv5" \
--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": "makotonlo/LLM2026_DPO_finalv5",
"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 "makotonlo/LLM2026_DPO_finalv5" \
--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": "makotonlo/LLM2026_DPO_finalv5",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use makotonlo/LLM2026_DPO_finalv5 with Docker Model Runner:
docker model run hf.co/makotonlo/LLM2026_DPO_finalv5
This model is a fine-tuned version of unsloth/Qwen2.5-7B-Instruct-bnb-4bit using Direct Preference Optimization (DPO) via the Unsloth library.
This repository contains LoRA adapter weights only. The base model must be loaded separately.
This repository contains LoRA adapter weights only. The base model must be loaded separately using the provided inference code.
This is a LoRA adapter model. Use it with the base model using the PEFT library.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = f"{repo_id}" # 自動的に今回のリポジトリ名が入るように修正
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
# Test inference
prompt = "Your question here"
inputs = tokenizer.apply_chat_template([{"role": "user", "content": prompt}], tokenize=True, add_generation_prompt=True, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0]))
Base model
Qwen/Qwen2.5-7B