Text Generation
Transformers
Safetensors
qwen3
Generated from Trainer
trl
sft
conversational
text-generation-inference
Instructions to use cs-552-2026-the-transformers/math_model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cs-552-2026-the-transformers/math_model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cs-552-2026-the-transformers/math_model") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("cs-552-2026-the-transformers/math_model") model = AutoModelForCausalLM.from_pretrained("cs-552-2026-the-transformers/math_model") 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 cs-552-2026-the-transformers/math_model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cs-552-2026-the-transformers/math_model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cs-552-2026-the-transformers/math_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/cs-552-2026-the-transformers/math_model
- SGLang
How to use cs-552-2026-the-transformers/math_model 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 "cs-552-2026-the-transformers/math_model" \ --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": "cs-552-2026-the-transformers/math_model", "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 "cs-552-2026-the-transformers/math_model" \ --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": "cs-552-2026-the-transformers/math_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use cs-552-2026-the-transformers/math_model with Docker Model Runner:
docker model run hf.co/cs-552-2026-the-transformers/math_model
Push exp8 GRPO best (step 750), gen temp=0.7 for pass@8
Browse files- README.md +4 -62
- config.json +1 -1
- generation_config.json +3 -3
- model.safetensors +2 -2
- tokenizer_config.json +1 -2
- trainer_state.json +0 -0
README.md
CHANGED
|
@@ -1,69 +1,11 @@
|
|
| 1 |
---
|
| 2 |
base_model: Qwen/Qwen3-1.7B
|
| 3 |
library_name: transformers
|
| 4 |
-
model_name: exp6_sft_numinamath_dpo
|
| 5 |
tags:
|
| 6 |
-
-
|
| 7 |
-
-
|
| 8 |
-
- trl
|
| 9 |
-
licence: license
|
| 10 |
---
|
| 11 |
|
| 12 |
-
#
|
| 13 |
|
| 14 |
-
|
| 15 |
-
It has been trained using [TRL](https://github.com/huggingface/trl).
|
| 16 |
-
|
| 17 |
-
## Quick start
|
| 18 |
-
|
| 19 |
-
```python
|
| 20 |
-
from transformers import pipeline
|
| 21 |
-
|
| 22 |
-
question = "If you had a time machine, but could only go to the past or the future once and never return, which would you choose and why?"
|
| 23 |
-
generator = pipeline("text-generation", model="cs-552-2026-the-transformers/math_model", device="cuda")
|
| 24 |
-
output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
|
| 25 |
-
print(output["generated_text"])
|
| 26 |
-
```
|
| 27 |
-
|
| 28 |
-
## Training procedure
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
This model was trained with DPO, a method introduced in [Direct Preference Optimization: Your Language Model is Secretly a Reward Model](https://huggingface.co/papers/2305.18290).
|
| 34 |
-
|
| 35 |
-
### Framework versions
|
| 36 |
-
|
| 37 |
-
- TRL: 0.27.2
|
| 38 |
-
- Transformers: 5.8.0
|
| 39 |
-
- Pytorch: 2.10.0+cu128
|
| 40 |
-
- Datasets: 4.8.5
|
| 41 |
-
- Tokenizers: 0.22.2
|
| 42 |
-
|
| 43 |
-
## Citations
|
| 44 |
-
|
| 45 |
-
Cite DPO as:
|
| 46 |
-
|
| 47 |
-
```bibtex
|
| 48 |
-
@inproceedings{rafailov2023direct,
|
| 49 |
-
title = {{Direct Preference Optimization: Your Language Model is Secretly a Reward Model}},
|
| 50 |
-
author = {Rafael Rafailov and Archit Sharma and Eric Mitchell and Christopher D. Manning and Stefano Ermon and Chelsea Finn},
|
| 51 |
-
year = 2023,
|
| 52 |
-
booktitle = {Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 - 16, 2023},
|
| 53 |
-
url = {http://papers.nips.cc/paper_files/paper/2023/hash/a85b405ed65c6477a4fe8302b5e06ce7-Abstract-Conference.html},
|
| 54 |
-
editor = {Alice Oh and Tristan Naumann and Amir Globerson and Kate Saenko and Moritz Hardt and Sergey Levine},
|
| 55 |
-
}
|
| 56 |
-
```
|
| 57 |
-
|
| 58 |
-
Cite TRL as:
|
| 59 |
-
|
| 60 |
-
```bibtex
|
| 61 |
-
@misc{vonwerra2022trl,
|
| 62 |
-
title = {{TRL: Transformer Reinforcement Learning}},
|
| 63 |
-
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},
|
| 64 |
-
year = 2020,
|
| 65 |
-
journal = {GitHub repository},
|
| 66 |
-
publisher = {GitHub},
|
| 67 |
-
howpublished = {\url{https://github.com/huggingface/trl}}
|
| 68 |
-
}
|
| 69 |
-
```
|
|
|
|
| 1 |
---
|
| 2 |
base_model: Qwen/Qwen3-1.7B
|
| 3 |
library_name: transformers
|
|
|
|
| 4 |
tags:
|
| 5 |
+
- math
|
| 6 |
+
- sft
|
|
|
|
|
|
|
| 7 |
---
|
| 8 |
|
| 9 |
+
# math_model
|
| 10 |
|
| 11 |
+
Fine-tuned version of [Qwen/Qwen3-1.7B](https://huggingface.co/Qwen/Qwen3-1.7B) for math reasoning.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
"bos_token_id": null,
|
| 8 |
-
"dtype": "
|
| 9 |
"eos_token_id": 151645,
|
| 10 |
"head_dim": 128,
|
| 11 |
"hidden_act": "silu",
|
|
|
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
"bos_token_id": null,
|
| 8 |
+
"dtype": "float32",
|
| 9 |
"eos_token_id": 151645,
|
| 10 |
"head_dim": 128,
|
| 11 |
"hidden_act": "silu",
|
generation_config.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
{
|
| 2 |
-
"bos_token_id": 151643,
|
| 3 |
"do_sample": true,
|
| 4 |
"eos_token_id": [
|
| 5 |
151645,
|
| 6 |
151643
|
| 7 |
],
|
| 8 |
"pad_token_id": 151643,
|
| 9 |
-
"temperature": 0.
|
| 10 |
"top_k": 20,
|
| 11 |
"top_p": 0.95,
|
| 12 |
-
"transformers_version": "
|
|
|
|
| 13 |
}
|
|
|
|
| 1 |
{
|
|
|
|
| 2 |
"do_sample": true,
|
| 3 |
"eos_token_id": [
|
| 4 |
151645,
|
| 5 |
151643
|
| 6 |
],
|
| 7 |
"pad_token_id": 151643,
|
| 8 |
+
"temperature": 0.7,
|
| 9 |
"top_k": 20,
|
| 10 |
"top_p": 0.95,
|
| 11 |
+
"transformers_version": "5.8.0",
|
| 12 |
+
"bos_token_id": 151643
|
| 13 |
}
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:23c085561ee4f5825163d83ad9fc5cc7accfaac86a241a96d54426232a45e20e
|
| 3 |
+
size 6882335328
|
tokenizer_config.json
CHANGED
|
@@ -26,6 +26,5 @@
|
|
| 26 |
"pad_token": "<|endoftext|>",
|
| 27 |
"split_special_tokens": false,
|
| 28 |
"tokenizer_class": "Qwen2Tokenizer",
|
| 29 |
-
"unk_token": null
|
| 30 |
-
"chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0].content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if message.content is string %}\n {%- set content = message.content %}\n {%- else %}\n {%- set content = '' %}\n {%- endif %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 > ns.last_query_index %}\n {%- if loop.last or (not loop.last and reasoning_content) %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content.strip('\\n') + '\\n</think>\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if enable_thinking is defined and enable_thinking is false %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- endif %}\n{%- endif %}"
|
| 31 |
}
|
|
|
|
| 26 |
"pad_token": "<|endoftext|>",
|
| 27 |
"split_special_tokens": false,
|
| 28 |
"tokenizer_class": "Qwen2Tokenizer",
|
| 29 |
+
"unk_token": null
|
|
|
|
| 30 |
}
|
trainer_state.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|