whitphx HF Staff commited on
Commit
8b3f54f
·
verified ·
1 Parent(s): 9b84456

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/tmpkomnej0y/9b844569597c6c2fdc4f2a273cebd8bef96f5799/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 MptForCausalLM.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/tmpkomnej0y/9b844569597c6c2fdc4f2a273cebd8bef96f5799/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 MptForCausalLM.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/tmpkomnej0y/9b844569597c6c2fdc4f2a273cebd8bef96f5799/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 MptForCausalLM.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/tmpkomnej0y/9b844569597c6c2fdc4f2a273cebd8bef96f5799/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 MptForCausalLM.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/tmpkomnej0y/9b844569597c6c2fdc4f2a273cebd8bef96f5799/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

README.md CHANGED
@@ -5,4 +5,20 @@ library_name: transformers.js
5
 
6
  https://huggingface.co/efederici/ipt-350m 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/efederici/ipt-350m 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/ipt-350m');
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`).
onnx/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f38588d4238680348dbb1c16c15d2bd2a3e7fc219990b9070c957616ae9ebc9f
3
+ size 1415934308
onnx/model_bnb4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b50247913af622839bc2047f2128af42fdb3cbc99f8b00b57b5fb823625769d7
3
+ size 377681023
onnx/model_fp16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:647bd92acff8bfafd3e9e6d48b346734d68f8274a740af4d0d0b84d76cb33091
3
+ size 708326313
onnx/model_int8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dd61dc3a2dab4fcd959ba829fdb5a8ebc803759d0403b65d5762ce5c8562c7f1
3
+ size 355081010
onnx/model_q4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5af5dd8b710a01d83a3140565ff740fb932dc792af8b6a4fa06f0c7bcbdf89ea
3
+ size 396553735
onnx/model_q4f16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dd9bd82b877548dfc2387d83978ab69e93c8172cfcef2df9e09cb85449c23f6d
3
+ size 274242964
onnx/model_uint8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d7407e5e697295d2f92297d65912fe280dc24d112a45176fe392550a174eea92
3
+ size 355081067