whitphx HF Staff commited on
Commit
2a64922
·
verified ·
1 Parent(s): c1d88f6

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
```
↳ ❌ `fp16`: `decoder_model_fp16.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/tmpjuyw_qv1/c1d88f6743334a1200e4948ef46f545acfa96568/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 GPTBigCodeForCausalLM.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
```
↳ ❌ `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/tmpjuyw_qv1/c1d88f6743334a1200e4948ef46f545acfa96568/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 GPTBigCodeForCausalLM.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/tmpjuyw_qv1/c1d88f6743334a1200e4948ef46f545acfa96568/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 GPTBigCodeForCausalLM.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/tmpjuyw_qv1/c1d88f6743334a1200e4948ef46f545acfa96568/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 GPTBigCodeForCausalLM.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/tmpjuyw_qv1/c1d88f6743334a1200e4948ef46f545acfa96568/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_modul

Files changed (2) hide show
  1. README.md +16 -0
  2. onnx/model.onnx +3 -0
README.md CHANGED
@@ -5,4 +5,20 @@ library_name: transformers.js
5
 
6
  https://huggingface.co/bigcode/starcoderbase-1b 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/bigcode/starcoderbase-1b 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/starcoderbase-1b');
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:5383a3b4503a86afe2fe04e9a2cfa8f58b930400e13a3de5799f6f66b0b19280
3
+ size 135080792