Text Generation
Transformers.js
ONNX
English
llama
code
python
maincoder
code-generation
reinforcement-learning
mcpo
conversational
Instructions to use Maincode/Maincoder-1B-ONNX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use Maincode/Maincoder-1B-ONNX with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-generation', 'Maincode/Maincoder-1B-ONNX');
Add sharded ONNX layout, transformers.js config, and generation config
#1
by yakuraku - opened
- .gitattributes +4 -0
- config.json +6 -1
- generation_config.json +7 -0
- onnx/model.onnx +3 -0
- onnx/model.onnx_data +3 -0
- onnx/model.onnx_data_1 +3 -0
- onnx/model.onnx_data_2 +3 -0
- onnx/model.onnx_data_3 +3 -0
- tokenizer_config.json +2 -1
.gitattributes
CHANGED
|
@@ -36,3 +36,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 36 |
decoder_model.onnx_data filter=lfs diff=lfs merge=lfs -text
|
| 37 |
decoder_with_past_model.onnx_data filter=lfs diff=lfs merge=lfs -text
|
| 38 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
decoder_model.onnx_data filter=lfs diff=lfs merge=lfs -text
|
| 37 |
decoder_with_past_model.onnx_data filter=lfs diff=lfs merge=lfs -text
|
| 38 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
onnx/model.onnx_data filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
onnx/model.onnx_data_1 filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
onnx/model.onnx_data_2 filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
onnx/model.onnx_data_3 filter=lfs diff=lfs merge=lfs -text
|
config.json
CHANGED
|
@@ -25,5 +25,10 @@
|
|
| 25 |
"transformers_version": "4.57.3",
|
| 26 |
"use_cache": false,
|
| 27 |
"use_qk_norm": true,
|
| 28 |
-
"vocab_size": 151936
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
}
|
|
|
|
| 25 |
"transformers_version": "4.57.3",
|
| 26 |
"use_cache": false,
|
| 27 |
"use_qk_norm": true,
|
| 28 |
+
"vocab_size": 151936,
|
| 29 |
+
"transformers.js_config": {
|
| 30 |
+
"use_external_data_format": {
|
| 31 |
+
"model.onnx": 4
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"eos_token_id": [
|
| 3 |
+
151643,
|
| 4 |
+
151645
|
| 5 |
+
],
|
| 6 |
+
"pad_token_id": 151643
|
| 7 |
+
}
|
onnx/model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:44435a74a48eda79a5f1b288655c56f6c1d2e75b59e50b774445b262b5bf8e86
|
| 3 |
+
size 1677425
|
onnx/model.onnx_data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:60377b980fce2d065236eaa816d3195b633509579947c5a841e527246d743c78
|
| 3 |
+
size 1602385920
|
onnx/model.onnx_data_1
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:540cdeba29ee065cfbf394a4e4336d2139e88e3e81f16add49a269c1a12fb70e
|
| 3 |
+
size 1610612736
|
onnx/model.onnx_data_2
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e4e4a16bd574f4df599de01e50e4a5a3718936ee32cecd326af2e3879ba20d09
|
| 3 |
+
size 891813888
|
onnx/model.onnx_data_3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9301a5203af463f0129f995b221340a2f7daf3c39ed6cb6cbe1a0ccbfa7e5135
|
| 3 |
+
size 933494976
|
tokenizer_config.json
CHANGED
|
@@ -204,5 +204,6 @@
|
|
| 204 |
"pad_token": "<|endoftext|>",
|
| 205 |
"split_special_tokens": false,
|
| 206 |
"tokenizer_class": "Qwen2Tokenizer",
|
| 207 |
-
"unk_token": null
|
|
|
|
| 208 |
}
|
|
|
|
| 204 |
"pad_token": "<|endoftext|>",
|
| 205 |
"split_special_tokens": false,
|
| 206 |
"tokenizer_class": "Qwen2Tokenizer",
|
| 207 |
+
"unk_token": null,
|
| 208 |
+
"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"
|
| 209 |
}
|