whitphx HF Staff commited on
Commit
aa3bd94
Β·
verified Β·
1 Parent(s): e447f93

Add/update the quantized ONNX model files and README.md for Transformers.js v3

Browse files

## Applied Quantizations

### βœ… Based on `model.onnx` *with* slimming

↳ ❌ `int8`: `model_int8.onnx` (added but JS-based E2E test failed)
```
/home/ubuntu/src/tjsmigration/node_modules/.pnpm/[email protected]/node_modules/onnxruntime-node/dist/backend.js:25
__classPrivateFieldGet(this, _OnnxruntimeSessionHandler_inferenceSession, "f").loadModel(pathOrBuffer, options);
^

Error: Could not find an implementation for ConvInteger(10) node with name '/beit/embeddings/patch_embeddings/projection/Conv_quant'
at new OnnxruntimeSessionHandler (/home/ubuntu/src/tjsmigration/node_modules/.pnpm/[email protected]/node_modules/onnxruntime-node/dist/backend.js:25:92)
at Immediate.<anonymous> (/home/ubuntu/src/tjsmigration/node_modules/.pnpm/[email protected]/node_modules/onnxruntime-node/dist/backend.js:67:29)
at process.processImmediate (node:internal/timers:485:21)

Node.js v22.16.0
```
↳ βœ… `uint8`: `model_uint8.onnx` (added)
↳ βœ… `q4`: `model_q4.onnx` (added)
↳ βœ… `q4f16`: `model_q4f16.onnx` (added)
↳ βœ… `bnb4`: `model_bnb4.onnx` (added)

README.md CHANGED
@@ -9,14 +9,14 @@ https://huggingface.co/microsoft/dit-base-finetuned-rvlcdip with ONNX weights to
9
 
10
  ## Usage (Transformers.js)
11
 
12
- 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/@xenova/transformers) using:
13
  ```bash
14
- npm i @xenova/transformers
15
  ```
16
 
17
  **Example:** Perform document image classification with `Xenova/dit-base-finetuned-rvlcdip`
18
  ```js
19
- import { pipeline } from '@xenova/transformers';
20
 
21
  // Create an image classification pipeline
22
  const classifier = await pipeline('image-classification', 'Xenova/dit-base-finetuned-rvlcdip');
@@ -26,8 +26,5 @@ const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve
26
  const output = await classifier(url);
27
  // [{ label: 'advertisement', score: 0.9035086035728455 }]
28
  ```
29
- ---
30
-
31
-
32
 
33
  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`).
 
9
 
10
  ## Usage (Transformers.js)
11
 
12
+ 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:
13
  ```bash
14
+ npm i @huggingface/transformers
15
  ```
16
 
17
  **Example:** Perform document image classification with `Xenova/dit-base-finetuned-rvlcdip`
18
  ```js
19
+ import { pipeline } from '@huggingface/transformers';
20
 
21
  // Create an image classification pipeline
22
  const classifier = await pipeline('image-classification', 'Xenova/dit-base-finetuned-rvlcdip');
 
26
  const output = await classifier(url);
27
  // [{ label: 'advertisement', score: 0.9035086035728455 }]
28
  ```
 
 
 
29
 
30
  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_bnb4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:81cd39641d4edce4c316deaddf41d1a2284936c5b592c1a6042c408c8ffd8c88
3
+ size 51529927
onnx/model_q4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2acc0c8ce1edd2d0380ceea7f5ce7bdac441a4fd7edcc574b328cb7473d6dc21
3
+ size 56837815
onnx/model_q4f16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:abee82f60147cb9a584e376bb27d452924db9f07d8c1ca30ae7e7d29b3595506
3
+ size 49758533
onnx/model_uint8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4e6af3f147cc08aaa3111426dee718f12dd4ccaa3365d88ad6a29825eb98264b
3
+ size 86967457