Add/update the quantized ONNX model files and README.md for Transformers.js v3
Browse files## Applied Quantizations
### ❌ Based on `decoder_model.onnx` *with* slimming
```
None
```
↳ ❌ `int8`: `decoder_model_int8.onnx` (added but JS-based E2E test failed)
```
dtype not specified for "model". Using the default dtype (fp32) for this device (cpu).
file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:30853
throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${localPath}".`);
^
Error: `local_files_only=true` or `env.allowRemoteModels=false` and file was not found locally at "/tmp/tmpirjispp8/4c98e9e3f0813ba360530df920368581ebf31b10/onnx/model.onnx".
at getModelFile (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:30853:27)
at async getSession (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7132:28)
at async file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7149:73
at async Promise.all (index 0)
at async constructSessions (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7147:31)
at async Promise.all (index 0)
at async GPT2LMHeadModel.from_pretrained (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7946:20)
at async AutoModelForCausalLM.from_pretrained (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:14326:20)
at async Promise.all (index 1)
at async loadItems (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:23881:5)
Node.js v22.16.0
```
↳ ❌ `uint8`: `decoder_model_uint8.onnx` (added but JS-based E2E test failed)
```
dtype not specified for "model". Using the default dtype (fp32) for this device (cpu).
file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:30853
throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${localPath}".`);
^
Error: `local_files_only=true` or `env.allowRemoteModels=false` and file was not found locally at "/tmp/tmpirjispp8/4c98e9e3f0813ba360530df920368581ebf31b10/onnx/model.onnx".
at getModelFile (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:30853:27)
at async getSession (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7132:28)
at async file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7149:73
at async Promise.all (index 0)
at async constructSessions (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7147:31)
at async Promise.all (index 0)
at async GPT2LMHeadModel.from_pretrained (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7946:20)
at async AutoModelForCausalLM.from_pretrained (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:14326:20)
at async Promise.all (index 1)
at async loadItems (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:23881:5)
Node.js v22.16.0
```
↳ ❌ `q4`: `decoder_model_q4.onnx` (added but JS-based E2E test failed)
```
dtype not specified for "model". Using the default dtype (fp32) for this device (cpu).
file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:30853
throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${localPath}".`);
^
Error: `local_files_only=true` or `env.allowRemoteModels=false` and file was not found locally at "/tmp/tmpirjispp8/4c98e9e3f0813ba360530df920368581ebf31b10/onnx/model.onnx".
at getModelFile (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:30853:27)
at async getSession (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7132:28)
at async file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7149:73
at async Promise.all (index 0)
at async constructSessions (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7147:31)
at async Promise.all (index 0)
at async GPT2LMHeadModel.from_pretrained (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7946:20)
at async AutoModelForCausalLM.from_pretrained (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:14326:20)
at async Promise.all (index 1)
at async loadItems (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:23881:5)
Node.js v22.16.0
```
↳ ❌ `q4f16`: `decoder_model_q4f16.onnx` (added but JS-based E2E test failed)
```
dtype not specified for "model". Using the default dtype (fp32) for this device (cpu).
file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:30853
throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${localPath}".`);
^
Error: `local_files_only=true` or `env.allowRemoteModels=false` and file was not found locally at "/tmp/tmpirjispp8/4c98e9e3f0813ba360530df920368581ebf31b10/onnx/model.onnx".
at getModelFile (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:30853:27)
at async getSession (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7132:28)
at async file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7149:73
at async Promise.all (index 0)
at async constructSessions (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7147:31)
at async Promise.all (index 0)
at async GPT2LMHeadModel.from_pretrained (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7946:20)
at async AutoModelForCausalLM.from_pretrained (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:14326:20)
at async Promise.all (index 1)
at async loadItems (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:23881:5)
Node.js v22.16.0
```
↳ ❌ `bnb4`: `decoder_model_bnb4.onnx` (added but JS-based E2E test failed)
```
dtype not specified for "model". Using the default dtype (fp32) for this device (cpu).
file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:30853
throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${localPath}".`);
^
Error: `local_files_only=true` or `env.allowRemoteModels=false` and file was not found locally at "/tmp/tmpirjispp8/4c98e9e3f0813ba360530df920368581ebf31b10/onnx/model.onnx".
at getModelFile (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:30853:27)
at async getSession (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7132:28)
at async file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7149:73
at async Promise.all (index 0)
at async constructSessions (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transfor
- README.md +16 -0
- onnx/model.onnx +3 -0
- onnx/model_bnb4.onnx +3 -0
- onnx/model_fp16.onnx +3 -0
- onnx/model_int8.onnx +3 -0
- onnx/model_q4.onnx +3 -0
- onnx/model_q4f16.onnx +3 -0
- onnx/model_uint8.onnx +3 -0
@@ -5,4 +5,20 @@ library_name: transformers.js
|
|
5 |
|
6 |
https://huggingface.co/MBZUAI/LaMini-GPT-124M with ONNX weights to be compatible with Transformers.js.
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using [🤗 Optimum](https://huggingface.co/docs/optimum/index) and structuring your repo like this one (with ONNX weights located in a subfolder named `onnx`).
|
|
|
5 |
|
6 |
https://huggingface.co/MBZUAI/LaMini-GPT-124M with ONNX weights to be compatible with Transformers.js.
|
7 |
|
8 |
+
## Usage (Transformers.js)
|
9 |
+
|
10 |
+
If you haven't already, you can install the [Transformers.js](https://huggingface.co/docs/transformers.js) JavaScript library from [NPM](https://www.npmjs.com/package/@huggingface/transformers) using:
|
11 |
+
```bash
|
12 |
+
npm i @huggingface/transformers
|
13 |
+
```
|
14 |
+
|
15 |
+
**Example:** Text generation.
|
16 |
+
|
17 |
+
```js
|
18 |
+
import { pipeline } from '@huggingface/transformers';
|
19 |
+
|
20 |
+
const generator = await pipeline('text-generation', 'Xenova/LaMini-GPT-124M');
|
21 |
+
const output = await generator('Once upon a time, there was', { max_new_tokens: 10 });
|
22 |
+
```
|
23 |
+
|
24 |
Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using [🤗 Optimum](https://huggingface.co/docs/optimum/index) and structuring your repo like this one (with ONNX weights located in a subfolder named `onnx`).
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5e12b5a85ff73294f25424b586b2e30eb5ff624f5588f900e1842fd1548959d8
|
3 |
+
size 500802211
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d7ee5bce0f91694fb248fcbb15e49bc76e6c6a38a47c9004f5cd32c655c1a8a6
|
3 |
+
size 499628716
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2f85acab821c75dd70621c4d8971a92b89606a82d6d195d919fe86f942305e60
|
3 |
+
size 250754916
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1cf687c053fdada2e87811daa446580795e62a74dc8ae31b0d6ea24905774981
|
3 |
+
size 281203243
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d7ee5bce0f91694fb248fcbb15e49bc76e6c6a38a47c9004f5cd32c655c1a8a6
|
3 |
+
size 499628716
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c809db68ffef58f2877fff18fb59ace4fd148839c284875acba5ac77ef3684ea
|
3 |
+
size 250754935
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4466925997f02b2e80014902bcb36ce7b6bfe3f66d36e7f2a50445b3ff3937c1
|
3 |
+
size 281203268
|