whitphx HF Staff commited on
Commit
f882495
Β·
verified Β·
1 Parent(s): fc7afa5

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

Browse files

## Applied Quantizations

### ❌ Based on `model.onnx` *with* slimming

```
None
```
↳ ❌ `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 '/owlvit/vision_model/embeddings/patch_embedding/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)

### ❌ Based on `model.onnx` *with* slimming

```
None
```
↳ ❌ `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 '/owlvit/vision_model/embeddings/patch_embedding/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/google/owlvit-base-patch32 with ONNX weights to be compat
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:** Zero-shot object detection w/ `Xenova/owlvit-base-patch32`.
18
  ```js
19
- import { pipeline } from '@xenova/transformers';
20
 
21
  const detector = await pipeline('zero-shot-object-detection', 'Xenova/owlvit-base-patch32');
22
 
@@ -36,13 +36,13 @@ const output = await detector(url, candidate_labels);
36
 
37
  **Example:** Zero-shot object detection w/ `Xenova/owlvit-base-patch32` (additional parameters).
38
  ```js
39
- import { pipeline } from '@xenova/transformers';
40
 
41
  const detector = await pipeline('zero-shot-object-detection', 'Xenova/owlvit-base-patch32');
42
 
43
  const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/beach.png';
44
  const candidate_labels = ['hat', 'book', 'sunglasses', 'camera'];
45
- const output = await detector(url, candidate_labels, { topk: 4, threshold: 0.05 });
46
  // [
47
  // { score: 0.1606510728597641, label: 'sunglasses', box: { xmin: 347, ymin: 229, xmax: 429, ymax: 264 } },
48
  // { score: 0.08935828506946564, label: 'hat', box: { xmin: 38, ymin: 174, xmax: 258, ymax: 364 } },
 
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:** Zero-shot object detection w/ `Xenova/owlvit-base-patch32`.
18
  ```js
19
+ import { pipeline } from '@huggingface/transformers';
20
 
21
  const detector = await pipeline('zero-shot-object-detection', 'Xenova/owlvit-base-patch32');
22
 
 
36
 
37
  **Example:** Zero-shot object detection w/ `Xenova/owlvit-base-patch32` (additional parameters).
38
  ```js
39
+ import { pipeline } from '@huggingface/transformers';
40
 
41
  const detector = await pipeline('zero-shot-object-detection', 'Xenova/owlvit-base-patch32');
42
 
43
  const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/beach.png';
44
  const candidate_labels = ['hat', 'book', 'sunglasses', 'camera'];
45
+ const output = await detector(url, candidate_labels, { top_k: 4, threshold: 0.05 });
46
  // [
47
  // { score: 0.1606510728597641, label: 'sunglasses', box: { xmin: 347, ymin: 229, xmax: 429, ymax: 264 } },
48
  // { score: 0.08935828506946564, label: 'hat', box: { xmin: 38, ymin: 174, xmax: 258, ymax: 364 } },
onnx/model_bnb4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd2cdf5a167e2ef808764a7d35563adf51ca00f8b51ce10d1e7c3c47de792ca2
3
+ size 183948525
onnx/model_q4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d8588092fea3ef14a2067485a44d78b9f9801e4a153421972356613abeac73a8
3
+ size 191730057
onnx/model_q4f16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:259c628beee565a1e5f495145b5e1f6839bdf9e209d989d866dd0328f05bb6a0
3
+ size 127312570
onnx/model_uint8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b597d1fc9ebf7c149b66c999280253bf9ba585b581f41e25a5b73d7cebf6a598
3
+ size 155621034