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 '/vit/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 +5 -5
- onnx/model_bnb4.onnx +3 -0
- onnx/model_q4.onnx +3 -0
- onnx/model_q4f16.onnx +3 -0
- onnx/model_uint8.onnx +3 -0
@@ -7,21 +7,21 @@ https://huggingface.co/google/vit-base-patch16-224 with ONNX weights to be compa
|
|
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/@
|
11 |
```bash
|
12 |
-
npm i @
|
13 |
```
|
14 |
|
15 |
**Example:** Perform image classification with `Xenova/vit-base-patch16-224`
|
16 |
```js
|
17 |
-
import { pipeline } from '@
|
18 |
|
19 |
-
const classifier = await pipeline('image-classification', 'Xenova/vit-base-patch16-224')
|
20 |
const urls = [
|
21 |
'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg',
|
22 |
'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/cats.jpg',
|
23 |
];
|
24 |
-
const output = await classifier(urls)
|
25 |
// [
|
26 |
// { label: 'tiger, Panthera tigris', score: 0.6074584722518921 },
|
27 |
// { label: 'Egyptian cat', score: 0.8246098756790161 }
|
|
|
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:** Perform image classification with `Xenova/vit-base-patch16-224`
|
16 |
```js
|
17 |
+
import { pipeline } from '@huggingface/transformers';
|
18 |
|
19 |
+
const classifier = await pipeline('image-classification', 'Xenova/vit-base-patch16-224');
|
20 |
const urls = [
|
21 |
'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg',
|
22 |
'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/cats.jpg',
|
23 |
];
|
24 |
+
const output = await classifier(urls);
|
25 |
// [
|
26 |
// { label: 'tiger, Panthera tigris', score: 0.6074584722518921 },
|
27 |
// { label: 'Egyptian cat', score: 0.8246098756790161 }
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3128b5cce5fe0941f4eedd9cfc97fb4a2e6beb3c4d2d3839285d2a09f0ae37be
|
3 |
+
size 54515038
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b4f57e8fc159eff2df75dd51def64df42d93356e441d5cc605e5b95d7ba95ae7
|
3 |
+
size 59822926
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ad81a2b9a21d5a89ce72c82d5abfb9eba4719be98cbad81c546e15637da1fd29
|
3 |
+
size 51248686
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8afcc0639070904a4c9f766b7d129de68fff5165d43636c4b526b004f5570b46
|
3 |
+
size 87684215
|