whitphx HF Staff commited on
Commit
67cfbec
·
verified ·
1 Parent(s): d4d11f3

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 '/dinov2/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
@@ -7,15 +7,15 @@ https://huggingface.co/facebook/dinov2-base-imagenet1k-1-layer with ONNX weights
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/@xenova/transformers) using:
11
  ```bash
12
- npm i @xenova/transformers
13
  ```
14
 
15
  **Example:** Image classification w/ `Xenova/dinov2-base-imagenet1k-1-layer`.
16
 
17
  ```javascript
18
- import { pipeline } from '@xenova/transformers';
19
 
20
  // Create image classification pipeline
21
  const classifier = await pipeline('image-classification', 'Xenova/dinov2-base-imagenet1k-1-layer', { quantized: false });
@@ -23,7 +23,7 @@ const classifier = await pipeline('image-classification', 'Xenova/dinov2-base-im
23
  // Classify an image
24
  const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/cats.jpg';
25
  const output = await classifier(url);
26
- console.log(output)
27
  // [{ label: 'tabby, tabby cat', score: 0.4475940465927124 }]
28
  ```
29
 
 
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:** Image classification w/ `Xenova/dinov2-base-imagenet1k-1-layer`.
16
 
17
  ```javascript
18
+ import { pipeline } from '@huggingface/transformers';
19
 
20
  // Create image classification pipeline
21
  const classifier = await pipeline('image-classification', 'Xenova/dinov2-base-imagenet1k-1-layer', { quantized: false });
 
23
  // Classify an image
24
  const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/cats.jpg';
25
  const output = await classifier(url);
26
+ console.log(output);
27
  // [{ label: 'tabby, tabby cat', score: 0.4475940465927124 }]
28
  ```
29
 
onnx/model_bnb4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d2cd000620140b64e33b704e59ebb9a9e2d413be1802636b6d89419d898ea538
3
+ size 57291181
onnx/model_q4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc8df78195990829314eb438f3c47008a6c896fb728092e892dce5b09e285cca
3
+ size 62599069
onnx/model_q4f16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:03118bdfb86c3394e70f4014de170ca71f3f514088640b28cbd395073d97b13e
3
+ size 52636289
onnx/model_uint8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e442d72138685c2fcaec4167f9f86f178cfa223c708617b1e55464b881ebdc7c
3
+ size 88568744