149 lines
3.4 KiB
Markdown
149 lines
3.4 KiB
Markdown
---
|
||
base_model: Qwen/Qwen2.5-3B-Instruct
|
||
library_name: transformers
|
||
tags:
|
||
- generated_from_trainer
|
||
- trl
|
||
- open-r1
|
||
- grpo
|
||
licence: license
|
||
---
|
||
# Model Card for LUNAR
|
||
|
||
This model is a fine-tuned version of [Qwen/Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct) on the NACC dataset.
|
||
It has been trained using [TRL](https://github.com/huggingface/trl).
|
||
|
||
## Quick start
|
||
|
||
```python
|
||
system_prompt = "Please reason step by step, and put your final answer within \\boxed{}."
|
||
|
||
question = """Question: The patient is a 70 year old ...
|
||
|
||
Using the information provided, determine the patient’s cognitive status.
|
||
|
||
Answer Choices:
|
||
A. Normal Cognition
|
||
B. Mild Cognitive Impairment
|
||
C. Dementia
|
||
"""
|
||
```
|
||
|
||
### Option 1: Hugging Face Transformers
|
||
|
||
```python
|
||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||
|
||
model_id = "vkola-lab/LUNAR"
|
||
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
||
model = AutoModelForCausalLM.from_pretrained(
|
||
model_id,
|
||
torch_dtype="auto",
|
||
device_map="auto",
|
||
)
|
||
|
||
messages = [
|
||
{"role": "system", "content": system_prompt},
|
||
{"role": "user", "content": question}
|
||
]
|
||
inputs = tokenizer.apply_chat_template(
|
||
messages,
|
||
add_generation_prompt=True,
|
||
return_tensors="pt",
|
||
return_dict=True,
|
||
).to(model.device)
|
||
|
||
outputs = model.generate(
|
||
**inputs,
|
||
max_new_tokens=10000,
|
||
do_sample=True,
|
||
temperature=1,
|
||
top_p=1.0,
|
||
)
|
||
|
||
response = tokenizer.decode(
|
||
outputs[0][inputs["input_ids"].shape[-1]:],
|
||
skip_special_tokens=True,
|
||
)
|
||
print(response)
|
||
```
|
||
|
||
### Option 2: vLLM
|
||
|
||
```python
|
||
from vllm import LLM, SamplingParams
|
||
|
||
llm = LLM(model="vkola-lab/LUNAR")
|
||
sampling_params = SamplingParams(temperature=1, top_p=1.0, max_tokens=10000)
|
||
|
||
messages = [
|
||
{"role": "system", "content": system_prompt},
|
||
{"role": "user", "content": question}
|
||
]
|
||
|
||
outputs = llm.chat(messages, sampling_params)
|
||
print(outputs[0].outputs[0].text)
|
||
```
|
||
|
||
Alternatively, serve the model with an OpenAI-compatible API:
|
||
|
||
```bash
|
||
vllm serve vkola-lab/LUNAR
|
||
```
|
||
|
||
## Training procedure
|
||
|
||
[](https://wandb.ai/sks99/open_r1_access/runs/nxwgq79u)
|
||
|
||
This model was trained with GRPO, a method introduced in [DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models](https://huggingface.co/papers/2402.03300).
|
||
|
||
### Framework versions
|
||
|
||
**Training**
|
||
|
||
- Python: 3.11.13
|
||
- CUDA: 12.4
|
||
- PyTorch: 2.6.0
|
||
- Triton: 3.2.0
|
||
- Transformers: 4.52.4
|
||
- TRL: 0.19.0
|
||
- vLLM: 0.8.5.post1
|
||
- DeepSpeed: 0.16.8
|
||
- Datasets: 4.0.0
|
||
- Tokenizers: 0.21.4
|
||
|
||
**Inference / Evaluation**
|
||
|
||
- Python: 3.12.11
|
||
- PyTorch: 2.9.0+cu128
|
||
- Transformers: 4.57.6
|
||
- vLLM: 0.11.2
|
||
|
||
## Citations
|
||
|
||
Cite LUNAR as:
|
||
|
||
<!-- Cite GRPO as:
|
||
|
||
```bibtex
|
||
@article{zhihong2024deepseekmath,
|
||
title = {{DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models}},
|
||
author = {Zhihong Shao and Peiyi Wang and Qihao Zhu and Runxin Xu and Junxiao Song and Mingchuan Zhang and Y. K. Li and Y. Wu and Daya Guo},
|
||
year = 2024,
|
||
eprint = {arXiv:2402.03300},
|
||
}
|
||
```
|
||
|
||
Cite TRL as:
|
||
|
||
```bibtex
|
||
@misc{vonwerra2022trl,
|
||
title = {{TRL: Transformer Reinforcement Learning}},
|
||
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},
|
||
year = 2020,
|
||
journal = {GitHub repository},
|
||
publisher = {GitHub},
|
||
howpublished = {\url{https://github.com/huggingface/trl}}
|
||
} -->
|
||
```
|