Text Generation
Transformers
Safetensors
qwen2
mergekit
Merge
conversational
text-generation-inference
Instructions to use tuanpasg/puffin-linear-coder-math with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tuanpasg/puffin-linear-coder-math with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tuanpasg/puffin-linear-coder-math") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tuanpasg/puffin-linear-coder-math") model = AutoModelForCausalLM.from_pretrained("tuanpasg/puffin-linear-coder-math", device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tuanpasg/puffin-linear-coder-math with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tuanpasg/puffin-linear-coder-math" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tuanpasg/puffin-linear-coder-math", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tuanpasg/puffin-linear-coder-math
- SGLang
How to use tuanpasg/puffin-linear-coder-math 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 "tuanpasg/puffin-linear-coder-math" \ --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": "tuanpasg/puffin-linear-coder-math", "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 "tuanpasg/puffin-linear-coder-math" \ --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": "tuanpasg/puffin-linear-coder-math", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tuanpasg/puffin-linear-coder-math with Docker Model Runner:
docker model run hf.co/tuanpasg/puffin-linear-coder-math
Upload folder using huggingface_hub
Browse files- README.md +13 -5
- config.json +5 -5
- mergekit_config.yml +9 -2
- model-00001-of-00001.safetensors +2 -2
- tokenizer_config.json +1 -1
README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
---
|
| 2 |
base_model:
|
| 3 |
-
- Qwen/Qwen2.5-Math-1.5B
|
| 4 |
- Qwen/Qwen2.5-Coder-1.5B
|
|
|
|
|
|
|
| 5 |
library_name: transformers
|
| 6 |
tags:
|
| 7 |
- mergekit
|
|
@@ -15,13 +16,13 @@ This is a merge of pre-trained language models created using [mergekit](https://
|
|
| 15 |
## Merge Details
|
| 16 |
### Merge Method
|
| 17 |
|
| 18 |
-
This model was merged using the [
|
| 19 |
|
| 20 |
### Models Merged
|
| 21 |
|
| 22 |
The following models were included in the merge:
|
| 23 |
-
* [Qwen/Qwen2.5-Math-1.5B](https://huggingface.co/Qwen/Qwen2.5-Math-1.5B)
|
| 24 |
* [Qwen/Qwen2.5-Coder-1.5B](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B)
|
|
|
|
| 25 |
|
| 26 |
### Configuration
|
| 27 |
|
|
@@ -31,10 +32,17 @@ The following YAML configuration was used to produce this model:
|
|
| 31 |
models:
|
| 32 |
- model: Qwen/Qwen2.5-Coder-1.5B
|
| 33 |
parameters:
|
|
|
|
| 34 |
weight: 0.9
|
| 35 |
- model: Qwen/Qwen2.5-Math-1.5B
|
| 36 |
parameters:
|
|
|
|
| 37 |
weight: 0.1
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
```
|
|
|
|
| 1 |
---
|
| 2 |
base_model:
|
|
|
|
| 3 |
- Qwen/Qwen2.5-Coder-1.5B
|
| 4 |
+
- Qwen/Qwen2.5-1.5B
|
| 5 |
+
- Qwen/Qwen2.5-Math-1.5B
|
| 6 |
library_name: transformers
|
| 7 |
tags:
|
| 8 |
- mergekit
|
|
|
|
| 16 |
## Merge Details
|
| 17 |
### Merge Method
|
| 18 |
|
| 19 |
+
This model was merged using the [TIES](https://arxiv.org/abs/2306.01708) merge method using [Qwen/Qwen2.5-1.5B](https://huggingface.co/Qwen/Qwen2.5-1.5B) as a base.
|
| 20 |
|
| 21 |
### Models Merged
|
| 22 |
|
| 23 |
The following models were included in the merge:
|
|
|
|
| 24 |
* [Qwen/Qwen2.5-Coder-1.5B](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B)
|
| 25 |
+
* [Qwen/Qwen2.5-Math-1.5B](https://huggingface.co/Qwen/Qwen2.5-Math-1.5B)
|
| 26 |
|
| 27 |
### Configuration
|
| 28 |
|
|
|
|
| 32 |
models:
|
| 33 |
- model: Qwen/Qwen2.5-Coder-1.5B
|
| 34 |
parameters:
|
| 35 |
+
density: 0.5
|
| 36 |
weight: 0.9
|
| 37 |
- model: Qwen/Qwen2.5-Math-1.5B
|
| 38 |
parameters:
|
| 39 |
+
density: 0.5
|
| 40 |
weight: 0.1
|
| 41 |
+
|
| 42 |
+
merge_method: ties
|
| 43 |
+
base_model: Qwen/Qwen2.5-1.5B
|
| 44 |
+
parameters:
|
| 45 |
+
normalize: false
|
| 46 |
+
int8_mask: true
|
| 47 |
+
dtype: float16
|
| 48 |
```
|
config.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"_name_or_path": "Qwen/Qwen2.5-
|
| 3 |
"architectures": [
|
| 4 |
"Qwen2ForCausalLM"
|
| 5 |
],
|
|
@@ -10,18 +10,18 @@
|
|
| 10 |
"hidden_size": 1536,
|
| 11 |
"initializer_range": 0.02,
|
| 12 |
"intermediate_size": 8960,
|
| 13 |
-
"max_position_embeddings":
|
| 14 |
-
"max_window_layers":
|
| 15 |
"model_type": "qwen2",
|
| 16 |
"num_attention_heads": 12,
|
| 17 |
"num_hidden_layers": 28,
|
| 18 |
"num_key_value_heads": 2,
|
| 19 |
"rms_norm_eps": 1e-06,
|
| 20 |
"rope_scaling": null,
|
| 21 |
-
"rope_theta":
|
| 22 |
"sliding_window": null,
|
| 23 |
"tie_word_embeddings": true,
|
| 24 |
-
"torch_dtype": "
|
| 25 |
"transformers_version": "4.45.1",
|
| 26 |
"use_cache": true,
|
| 27 |
"use_mrope": false,
|
|
|
|
| 1 |
{
|
| 2 |
+
"_name_or_path": "Qwen/Qwen2.5-1.5B",
|
| 3 |
"architectures": [
|
| 4 |
"Qwen2ForCausalLM"
|
| 5 |
],
|
|
|
|
| 10 |
"hidden_size": 1536,
|
| 11 |
"initializer_range": 0.02,
|
| 12 |
"intermediate_size": 8960,
|
| 13 |
+
"max_position_embeddings": 131072,
|
| 14 |
+
"max_window_layers": 28,
|
| 15 |
"model_type": "qwen2",
|
| 16 |
"num_attention_heads": 12,
|
| 17 |
"num_hidden_layers": 28,
|
| 18 |
"num_key_value_heads": 2,
|
| 19 |
"rms_norm_eps": 1e-06,
|
| 20 |
"rope_scaling": null,
|
| 21 |
+
"rope_theta": 1000000.0,
|
| 22 |
"sliding_window": null,
|
| 23 |
"tie_word_embeddings": true,
|
| 24 |
+
"torch_dtype": "float16",
|
| 25 |
"transformers_version": "4.45.1",
|
| 26 |
"use_cache": true,
|
| 27 |
"use_mrope": false,
|
mergekit_config.yml
CHANGED
|
@@ -1,9 +1,16 @@
|
|
| 1 |
models:
|
| 2 |
- model: Qwen/Qwen2.5-Coder-1.5B
|
| 3 |
parameters:
|
|
|
|
| 4 |
weight: 0.9
|
| 5 |
- model: Qwen/Qwen2.5-Math-1.5B
|
| 6 |
parameters:
|
|
|
|
| 7 |
weight: 0.1
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
models:
|
| 2 |
- model: Qwen/Qwen2.5-Coder-1.5B
|
| 3 |
parameters:
|
| 4 |
+
density: 0.5
|
| 5 |
weight: 0.9
|
| 6 |
- model: Qwen/Qwen2.5-Math-1.5B
|
| 7 |
parameters:
|
| 8 |
+
density: 0.5
|
| 9 |
weight: 0.1
|
| 10 |
+
|
| 11 |
+
merge_method: ties
|
| 12 |
+
base_model: Qwen/Qwen2.5-1.5B
|
| 13 |
+
parameters:
|
| 14 |
+
normalize: false
|
| 15 |
+
int8_mask: true
|
| 16 |
+
dtype: float16
|
model-00001-of-00001.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:52bb27a6a10362ed99ec8c0480e93fdbb17ebc73c411d16aa78e944aadc9b24a
|
| 3 |
+
size 3554214416
|
tokenizer_config.json
CHANGED
|
@@ -195,7 +195,7 @@
|
|
| 195 |
"<|video_pad|>"
|
| 196 |
],
|
| 197 |
"bos_token": null,
|
| 198 |
-
"chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- '
|
| 199 |
"clean_up_tokenization_spaces": false,
|
| 200 |
"eos_token": "<|endoftext|>",
|
| 201 |
"errors": "replace",
|
|
|
|
| 195 |
"<|video_pad|>"
|
| 196 |
],
|
| 197 |
"bos_token": null,
|
| 198 |
+
"chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\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 {%- else %}\n {{- '<|im_start|>system\\nYou are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) or (message.role == \"assistant\" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.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{%- endif %}\n",
|
| 199 |
"clean_up_tokenization_spaces": false,
|
| 200 |
"eos_token": "<|endoftext|>",
|
| 201 |
"errors": "replace",
|