whitphx HF Staff commited on
Commit
0eda11e
Β·
verified Β·
1 Parent(s): 62536cf

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

Browse files

## Applied Quantizations

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

↳ βœ… `int8`: `vision_model_int8.onnx` (added)
↳ βœ… `uint8`: `vision_model_uint8.onnx` (added)
↳ βœ… `q4`: `vision_model_q4.onnx` (added)
↳ βœ… `q4f16`: `vision_model_q4f16.onnx` (added)
↳ βœ… `bnb4`: `vision_model_bnb4.onnx` (added)

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

↳ βœ… `int8`: `vision_model_int8.onnx` (added)
↳ βœ… `uint8`: `vision_model_uint8.onnx` (added)
↳ βœ… `q4`: `vision_model_q4.onnx` (added)
↳ βœ… `q4f16`: `vision_model_q4f16.onnx` (added)
↳ βœ… `bnb4`: `vision_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 '/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 '/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 `text_model.onnx` *with* slimming

↳ βœ… `int8`: `text_model_int8.onnx` (added)
↳ βœ… `uint8`: `text_model_uint8.onnx` (added)
↳ βœ… `q4`: `text_model_q4.onnx` (added)
↳ βœ… `q4f16`: `text_model_q4f16.onnx` (added)
↳ βœ… `bnb4`: `text_model_bnb4.onnx` (added)

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

↳ βœ… `int8`: `text_model_int8.onnx` (added)
↳ βœ… `uint8`: `text_model_uint8.onnx` (added)
↳ βœ… `q4`: `text_model_q4.onnx` (added)
↳ βœ… `q4f16`: `text_model_q4f16.onnx` (added)
↳ βœ… `bnb4`: `text_model_bnb4.onnx` (added)

README.md CHANGED
@@ -7,14 +7,14 @@ https://huggingface.co/google/siglip-base-patch16-512 with ONNX weights to be co
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:** Zero-shot image classification w/ `Xenova/siglip-base-patch16-512`:
16
  ```js
17
- import { pipeline } from '@xenova/transformers';
18
 
19
  const classifier = await pipeline('zero-shot-image-classification', 'Xenova/siglip-base-patch16-512');
20
  const url = 'http://images.cocodataset.org/val2017/000000039769.jpg';
@@ -31,7 +31,7 @@ console.log(output);
31
  **Example:** Compute text embeddings with `SiglipTextModel`.
32
 
33
  ```javascript
34
- import { AutoTokenizer, SiglipTextModel } from '@xenova/transformers';
35
 
36
  // Load tokenizer and text model
37
  const tokenizer = await AutoTokenizer.from_pretrained('Xenova/siglip-base-patch16-512');
@@ -54,7 +54,7 @@ const { pooler_output } = await text_model(text_inputs);
54
  **Example:** Compute vision embeddings with `SiglipVisionModel`.
55
 
56
  ```javascript
57
- import { AutoProcessor, SiglipVisionModel, RawImage} from '@xenova/transformers';
58
 
59
  // Load processor and vision model
60
  const processor = await AutoProcessor.from_pretrained('Xenova/siglip-base-patch16-512');
 
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:** Zero-shot image classification w/ `Xenova/siglip-base-patch16-512`:
16
  ```js
17
+ import { pipeline } from '@huggingface/transformers';
18
 
19
  const classifier = await pipeline('zero-shot-image-classification', 'Xenova/siglip-base-patch16-512');
20
  const url = 'http://images.cocodataset.org/val2017/000000039769.jpg';
 
31
  **Example:** Compute text embeddings with `SiglipTextModel`.
32
 
33
  ```javascript
34
+ import { AutoTokenizer, SiglipTextModel } from '@huggingface/transformers';
35
 
36
  // Load tokenizer and text model
37
  const tokenizer = await AutoTokenizer.from_pretrained('Xenova/siglip-base-patch16-512');
 
54
  **Example:** Compute vision embeddings with `SiglipVisionModel`.
55
 
56
  ```javascript
57
+ import { AutoProcessor, SiglipVisionModel, RawImage} from '@huggingface/transformers';
58
 
59
  // Load processor and vision model
60
  const processor = await AutoProcessor.from_pretrained('Xenova/siglip-base-patch16-512');
onnx/model_bnb4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4cce841538a10302ef9dc71cc445bccda9df3e3e8bc01c0247f18cc49b236bdc
3
+ size 209488499
onnx/model_q4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f5bb2a6e991621f1797e949b27f6739297ab7bb9616c7fe2ab1ea6d6e9faefc0
3
+ size 220509748
onnx/model_q4f16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:895ed91a979417e87054ef42ed21e95afa195b5bee5ad6245fc116a23debd3fb
3
+ size 154618571
onnx/model_uint8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae85c92b8015611fb6e5cb96982630ffb6f20159d9693013e424992c0588eca9
3
+ size 207635653
onnx/text_model_bnb4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a937d013eed03408b09dc8afd36277844c6f8f102ed3ccc6768551f0cbe6d63f
3
+ size 149385374
onnx/text_model_int8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:46fa16c891138ae003391c2f41754fe32d5c3bde3ab6c5dbb50461d6ef3b9a74
3
+ size 110982746
onnx/text_model_q4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3ddf30c6db0c552735a2860e740e234d21a848fc99fdde8b4e9fcaba6f0beea3
3
+ size 154693262
onnx/text_model_q4f16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d7b6bb44e4c319c5ee9746608a40fa47697875752f97ae239cee333512d2fdd5
3
+ size 98710743
onnx/text_model_uint8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ad7f26def9471771005d15c3b06ad9009527591a9db01695425f589045a1255e
3
+ size 110982789
onnx/vision_model_bnb4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5e3a00caa07c62af2b4e5918d7e779dcf7aeae0b81ea125c6b21b41ae06b9082
3
+ size 60093078
onnx/vision_model_int8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:800dc281f4305806ecb376063c10bffd5ef4589a7383fdbbb5a1e4af6c4a3b16
3
+ size 96642642
onnx/vision_model_q4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:415d47cf9088eb6f98cd65ef7fdfcfe819a8191673fb78dacc86fc53306ecf19
3
+ size 65806439
onnx/vision_model_q4f16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:75c6f5b426ef5ec40fa8e5d4dc7bd82fea97b7a6aae94d27332723fe8cbb2d1d
3
+ size 55897852
onnx/vision_model_uint8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9980395d3295ad4137ac1ec56481fef4c7da332e50127a3e1857a6c4f327b422
3
+ size 96642689