Views
No views yet
<think> tokens<instruction> tag)| Metric | Initial | Final (Epoch 3) |
|---|---|---|
| Loss | 2.083 | 1.164 |
| NLL Loss | 2.012 | 1.096 |
| Rewards Accuracy | 38.9% | 59.3% |
| Eval Loss | 2.054 | 1.164 |
1vllm serve llm-model-lab/thinking-v2-3epoch \
2 --enable-lora \
3 --lora-modules orpo=llm-model-lab/gemma3-27b-orpo-thinking-v2 \
4 --max-lora-rank 128 \
5 --dtype bfloat16 \
6 --trust-remote-code \
7 --gpu-memory-utilization 0.91from openai import OpenAI
2
3client = OpenAI(base_url="http://localhost:8000/v1", api_key="dummy")
4
5response = client.chat.completions.create(
6 model="orpo", # matches lora-modules key
7 messages=[
8 {"role": "system", "content": "You are a helpful AI assistant."},
9 {"role": "user", "content": "Explain quantum computing simply."}
10 ],
11 extra_body={"chat_template_kwargs": {"enable_thinking": True}},
12 max_tokens=2048
13)
14
15print(response.choices[0].message.content)1from transformers import AutoModelForCausalLM, AutoTokenizer
2from peft import PeftModel
3import torch
4
5# Load base model
6model = AutoModelForCausalLM.from_pretrained(
7 "llm-model-lab/thinking-v2-3epoch",
8 torch_dtype=torch.bfloat16,
9 device_map="auto",
10 attn_implementation="eager"
11)
12
13# Load ORPO adapter
14model = PeftModel.from_pretrained(
15 model,
16 "llm-model-lab/gemma3-27b-orpo-thinking-v2"
17)
18
19tokenizer = AutoTokenizer.from_pretrained("llm-model-lab/gemma3-27b-orpo-thinking-v2")
20
21# Generate
22messages = [
23 {"role": "system", "content": "You are a helpful assistant."},
24 {"role": "user", "content": "Hello!"}
25]
26inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
27outputs = model.generate(inputs, max_new_tokens=512, temperature=0.7)
28print(tokenizer.decode(outputs[0], skip_special_tokens=True))1@article{hong2024orpo,
2 title = {{ORPO: Monolithic Preference Optimization without Reference Model}},
3 author = {Jiwoo Hong and Noah Lee and James Thorne},
4 year = 2024,
5 eprint = {arXiv:2403.07691}
6}1@misc{vonwerra2022trl,
2 title = {{TRL: Transformer Reinforcement Learning}},
3 author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
4 year = 2020,
5 journal = {GitHub repository},
6 publisher = {GitHub},
7 howpublished = {\url{https://github.com/huggingface/trl}}
8}