Instructions to use av-codes/Supra-50M-Instruct-ONNX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use av-codes/Supra-50M-Instruct-ONNX with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-generation', 'av-codes/Supra-50M-Instruct-ONNX');
Add ONNX weights (fp32 + q8) for Transformers.js
Browse files- README.md +48 -0
- config.json +34 -0
- generation_config.json +7 -0
- onnx/model.onnx +3 -0
- onnx/model_quantized.onnx +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +9 -0
README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: SupraLabs/Supra-50M-Instruct
|
| 3 |
+
library_name: transformers.js
|
| 4 |
+
tags:
|
| 5 |
+
- onnx
|
| 6 |
+
- transformers.js
|
| 7 |
+
- llama
|
| 8 |
+
- text-generation
|
| 9 |
+
license: apache-2.0
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# Supra-50M-Instruct ONNX
|
| 13 |
+
|
| 14 |
+
ONNX weights for [SupraLabs/Supra-50M-Instruct](https://huggingface.co/SupraLabs/Supra-50M-Instruct), compatible with [Transformers.js](https://huggingface.co/docs/transformers.js).
|
| 15 |
+
|
| 16 |
+
## Usage (Transformers.js v3)
|
| 17 |
+
|
| 18 |
+
```javascript
|
| 19 |
+
import { pipeline } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@3";
|
| 20 |
+
|
| 21 |
+
const generator = await pipeline(
|
| 22 |
+
"text-generation",
|
| 23 |
+
"av/Supra-50M-Instruct-ONNX",
|
| 24 |
+
{ dtype: "q8" },
|
| 25 |
+
);
|
| 26 |
+
|
| 27 |
+
const messages = [
|
| 28 |
+
{ role: "user", content: "Explain what a neural network is in simple terms." },
|
| 29 |
+
];
|
| 30 |
+
|
| 31 |
+
const output = await generator(messages, { max_new_tokens: 256 });
|
| 32 |
+
console.log(output[0].generated_text.at(-1).content);
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
## Variants
|
| 36 |
+
|
| 37 |
+
| Variant | File | Size |
|
| 38 |
+
|---------|------|------|
|
| 39 |
+
| fp32 | `onnx/model.onnx` | 199 MB |
|
| 40 |
+
| q8 (int8) | `onnx/model_quantized.onnx` | 50 MB |
|
| 41 |
+
|
| 42 |
+
## Conversion
|
| 43 |
+
|
| 44 |
+
Exported with [Optimum](https://huggingface.co/docs/optimum) and quantized with ONNX Runtime:
|
| 45 |
+
|
| 46 |
+
```bash
|
| 47 |
+
optimum-cli export onnx --model SupraLabs/Supra-50M-Instruct --task text-generation-with-past ./onnx-export/
|
| 48 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"LlamaForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 0,
|
| 8 |
+
"dtype": "float32",
|
| 9 |
+
"eos_token_id": 2,
|
| 10 |
+
"head_dim": 64,
|
| 11 |
+
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 512,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 1408,
|
| 15 |
+
"max_position_embeddings": 1024,
|
| 16 |
+
"mlp_bias": false,
|
| 17 |
+
"model_type": "llama",
|
| 18 |
+
"num_attention_heads": 8,
|
| 19 |
+
"num_hidden_layers": 12,
|
| 20 |
+
"num_key_value_heads": 4,
|
| 21 |
+
"pad_token_id": 1,
|
| 22 |
+
"pretraining_tp": 1,
|
| 23 |
+
"rms_norm_eps": 1e-06,
|
| 24 |
+
"rope_parameters": {
|
| 25 |
+
"rope_theta": 10000,
|
| 26 |
+
"rope_type": "default"
|
| 27 |
+
},
|
| 28 |
+
"rope_scaling": null,
|
| 29 |
+
"rope_theta": 10000.0,
|
| 30 |
+
"tie_word_embeddings": true,
|
| 31 |
+
"transformers_version": "4.57.6",
|
| 32 |
+
"use_cache": true,
|
| 33 |
+
"vocab_size": 32000
|
| 34 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 0,
|
| 4 |
+
"eos_token_id": 2,
|
| 5 |
+
"pad_token_id": 1,
|
| 6 |
+
"transformers_version": "4.57.6"
|
| 7 |
+
}
|
onnx/model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a9bc5d1ec616f9571dcc70422a843f5e92689fe70d3b02b7618d4cfb5a5fdd47
|
| 3 |
+
size 207639912
|
onnx/model_quantized.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ab9f05ffeb6c1aaf946312cc6cff1aec00d9bf977c7ee6983f7d0751f6efd242
|
| 3 |
+
size 52617323
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": "<s>",
|
| 3 |
+
"eos_token": "</s>",
|
| 4 |
+
"model_max_length": 1024,
|
| 5 |
+
"pad_token": "<pad>",
|
| 6 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 7 |
+
"unk_token": "<unk>",
|
| 8 |
+
"chat_template": "{% if messages[0]['role'] == 'system' %}{% set system_message = messages[0]['content'] %}{% set loop_messages = messages[1:] %}{% else %}{% set system_message = '' %}{% set loop_messages = messages %}{% endif %}Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n{% for message in loop_messages %}{% if message['role'] == 'user' %}### Instruction:\n{{ message['content'] }}\n\n{% elif message['role'] == 'assistant' %}### Response:\n{{ message['content'] }}{{ eos_token }}\n\n{% endif %}{% endfor %}### Response:\n"
|
| 9 |
+
}
|