Text Generation
Transformers
TensorBoard
Safetensors
qwen2
Generated from Trainer
trl
sft
conversational
text-generation-inference
Instructions to use anujjamwal/Qwen2.5-Math-1.5B-hcot with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use anujjamwal/Qwen2.5-Math-1.5B-hcot with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="anujjamwal/Qwen2.5-Math-1.5B-hcot") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("anujjamwal/Qwen2.5-Math-1.5B-hcot") model = AutoModelForCausalLM.from_pretrained("anujjamwal/Qwen2.5-Math-1.5B-hcot") 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 anujjamwal/Qwen2.5-Math-1.5B-hcot with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "anujjamwal/Qwen2.5-Math-1.5B-hcot" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "anujjamwal/Qwen2.5-Math-1.5B-hcot", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/anujjamwal/Qwen2.5-Math-1.5B-hcot
- SGLang
How to use anujjamwal/Qwen2.5-Math-1.5B-hcot 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 "anujjamwal/Qwen2.5-Math-1.5B-hcot" \ --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": "anujjamwal/Qwen2.5-Math-1.5B-hcot", "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 "anujjamwal/Qwen2.5-Math-1.5B-hcot" \ --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": "anujjamwal/Qwen2.5-Math-1.5B-hcot", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use anujjamwal/Qwen2.5-Math-1.5B-hcot with Docker Model Runner:
docker model run hf.co/anujjamwal/Qwen2.5-Math-1.5B-hcot
Training in progress, epoch 1
Browse files- .gitattributes +1 -0
- README.md +57 -0
- chat_template.jinja +7 -0
- config.json +62 -0
- generation_config.json +9 -0
- model.safetensors +3 -0
- runs/Feb23_18-51-27_3140bbd8edc3/events.out.tfevents.1771872687.3140bbd8edc3.578.0 +3 -0
- runs/Feb23_18-52-56_3140bbd8edc3/events.out.tfevents.1771872776.3140bbd8edc3.578.1 +3 -0
- runs/Feb23_20-07-44_3140bbd8edc3/events.out.tfevents.1771877264.3140bbd8edc3.578.2 +3 -0
- tokenizer.json +3 -0
- tokenizer_config.json +19 -0
- training_args.bin +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: Qwen/Qwen2.5-Math-1.5B
|
| 3 |
+
library_name: transformers
|
| 4 |
+
model_name: Qwen2.5-Math-1.5B-hcot
|
| 5 |
+
tags:
|
| 6 |
+
- generated_from_trainer
|
| 7 |
+
- trl
|
| 8 |
+
- sft
|
| 9 |
+
licence: license
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# Model Card for Qwen2.5-Math-1.5B-hcot
|
| 13 |
+
|
| 14 |
+
This model is a fine-tuned version of [Qwen/Qwen2.5-Math-1.5B](https://huggingface.co/Qwen/Qwen2.5-Math-1.5B).
|
| 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="anujjamwal/Qwen2.5-Math-1.5B-hcot", 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 SFT.
|
| 34 |
+
|
| 35 |
+
### Framework versions
|
| 36 |
+
|
| 37 |
+
- TRL: 0.28.0
|
| 38 |
+
- Transformers: 5.0.0
|
| 39 |
+
- Pytorch: 2.10.0+cu128
|
| 40 |
+
- Datasets: 4.0.0
|
| 41 |
+
- Tokenizers: 0.22.2
|
| 42 |
+
|
| 43 |
+
## Citations
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
Cite TRL as:
|
| 48 |
+
|
| 49 |
+
```bibtex
|
| 50 |
+
@software{vonwerra2020trl,
|
| 51 |
+
title = {{TRL: Transformers Reinforcement Learning}},
|
| 52 |
+
author = {von Werra, Leandro and Belkada, Younes and Tunstall, Lewis and Beeching, Edward and Thrush, Tristan and Lambert, Nathan and Huang, Shengyi and Rasul, Kashif and Gallouédec, Quentin},
|
| 53 |
+
license = {Apache-2.0},
|
| 54 |
+
url = {https://github.com/huggingface/trl},
|
| 55 |
+
year = {2020}
|
| 56 |
+
}
|
| 57 |
+
```
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% for message in messages %}{% if message['role'] == 'system' %}<|im_start|>system
|
| 2 |
+
{{ message['content'] }}<|im_end|>
|
| 3 |
+
{% elif message['role'] == 'user' %}<|im_start|>user
|
| 4 |
+
{{ message['content'] }}<|im_end|>
|
| 5 |
+
{% elif message['role'] == 'assistant' %}<|im_start|>assistant
|
| 6 |
+
{% generation %}{{ message['content'] }}{% endgeneration %}<|im_end|>
|
| 7 |
+
{% endif %}{% endfor %}
|
config.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen2ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_dropout": 0.0,
|
| 6 |
+
"bos_token_id": null,
|
| 7 |
+
"dtype": "bfloat16",
|
| 8 |
+
"eos_token_id": 151643,
|
| 9 |
+
"hidden_act": "silu",
|
| 10 |
+
"hidden_size": 1536,
|
| 11 |
+
"initializer_range": 0.02,
|
| 12 |
+
"intermediate_size": 8960,
|
| 13 |
+
"layer_types": [
|
| 14 |
+
"full_attention",
|
| 15 |
+
"full_attention",
|
| 16 |
+
"full_attention",
|
| 17 |
+
"full_attention",
|
| 18 |
+
"full_attention",
|
| 19 |
+
"full_attention",
|
| 20 |
+
"full_attention",
|
| 21 |
+
"full_attention",
|
| 22 |
+
"full_attention",
|
| 23 |
+
"full_attention",
|
| 24 |
+
"full_attention",
|
| 25 |
+
"full_attention",
|
| 26 |
+
"full_attention",
|
| 27 |
+
"full_attention",
|
| 28 |
+
"full_attention",
|
| 29 |
+
"full_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"full_attention",
|
| 32 |
+
"full_attention",
|
| 33 |
+
"full_attention",
|
| 34 |
+
"full_attention",
|
| 35 |
+
"full_attention",
|
| 36 |
+
"full_attention",
|
| 37 |
+
"full_attention",
|
| 38 |
+
"full_attention",
|
| 39 |
+
"full_attention",
|
| 40 |
+
"full_attention",
|
| 41 |
+
"full_attention"
|
| 42 |
+
],
|
| 43 |
+
"max_position_embeddings": 4096,
|
| 44 |
+
"max_window_layers": 21,
|
| 45 |
+
"model_type": "qwen2",
|
| 46 |
+
"num_attention_heads": 12,
|
| 47 |
+
"num_hidden_layers": 28,
|
| 48 |
+
"num_key_value_heads": 2,
|
| 49 |
+
"pad_token_id": 151643,
|
| 50 |
+
"rms_norm_eps": 1e-06,
|
| 51 |
+
"rope_parameters": {
|
| 52 |
+
"rope_theta": 10000,
|
| 53 |
+
"rope_type": "default"
|
| 54 |
+
},
|
| 55 |
+
"sliding_window": null,
|
| 56 |
+
"tie_word_embeddings": true,
|
| 57 |
+
"transformers_version": "5.0.0",
|
| 58 |
+
"use_cache": false,
|
| 59 |
+
"use_mrope": false,
|
| 60 |
+
"use_sliding_window": false,
|
| 61 |
+
"vocab_size": 151668
|
| 62 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"do_sample": false,
|
| 3 |
+
"eos_token_id": [
|
| 4 |
+
151643
|
| 5 |
+
],
|
| 6 |
+
"max_new_tokens": 2048,
|
| 7 |
+
"pad_token_id": 151643,
|
| 8 |
+
"transformers_version": "5.0.0"
|
| 9 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4a631570fc65201db27b0741d19c3fdcdb71cc4678063e28d610ee15e31feb26
|
| 3 |
+
size 4268442032
|
runs/Feb23_18-51-27_3140bbd8edc3/events.out.tfevents.1771872687.3140bbd8edc3.578.0
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1d2923d482c192c646f24e0b2f708a8ed7ff9265d8baf98c642fad8016564eeb
|
| 3 |
+
size 19423
|
runs/Feb23_18-52-56_3140bbd8edc3/events.out.tfevents.1771872776.3140bbd8edc3.578.1
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:36abce149815672fb0630a759750a089e5faba33f7f07e6d3d68ff31bb143f84
|
| 3 |
+
size 442179
|
runs/Feb23_20-07-44_3140bbd8edc3/events.out.tfevents.1771877264.3140bbd8edc3.578.2
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:949663832859c11f55603b555a2c895174bf061ce172d6a89dabb74aeadb389a
|
| 3 |
+
size 21700
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8be3e81ad4a729cf43b0a2eb03504fea95988d21bce9eb8b320a2baae5e7d438
|
| 3 |
+
size 11422450
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": null,
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "<|endoftext|>",
|
| 7 |
+
"errors": "replace",
|
| 8 |
+
"extra_special_tokens": [
|
| 9 |
+
"[THOUGHT]",
|
| 10 |
+
"[SOLUTION]",
|
| 11 |
+
"[RETURN]"
|
| 12 |
+
],
|
| 13 |
+
"is_local": false,
|
| 14 |
+
"model_max_length": 131072,
|
| 15 |
+
"pad_token": "<|endoftext|>",
|
| 16 |
+
"split_special_tokens": false,
|
| 17 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 18 |
+
"unk_token": null
|
| 19 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:104a0bd5e2bcb84faa81c3f1194aa5371a9e71d80bfdd0a4995d4cd83b35a1f0
|
| 3 |
+
size 5713
|