Xenova HF Staff whitphx HF Staff commited on
Commit
fc4d565
·
verified ·
1 Parent(s): 4d4550c

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

Browse files

- Add/update the quantized ONNX model files and README.md for Transformers.js v3 (8ef7d3a0972bbb55e1e4c56023fc237cace30188)


Co-authored-by: Yuichiro Tachibana <whitphx@users.noreply.huggingface.co>

README.md CHANGED
@@ -6,4 +6,22 @@ pipeline_tag: zero-shot-object-detection
6
 
7
  https://huggingface.co/google/owlvit-base-patch16 with ONNX weights to be compatible with Transformers.js.
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  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`).
 
6
 
7
  https://huggingface.co/google/owlvit-base-patch16 with ONNX weights to be compatible with Transformers.js.
8
 
9
+ ## Usage (Transformers.js)
10
+
11
+ 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:
12
+ ```bash
13
+ npm i @huggingface/transformers
14
+ ```
15
+
16
+ **Example:** Zero-shot object detection.
17
+
18
+ ```js
19
+ import { pipeline } from '@huggingface/transformers';
20
+
21
+ const detector = await pipeline('zero-shot-object-detection', 'Xenova/owlvit-base-patch16');
22
+ const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/astronaut.png';
23
+ const candidate_labels = ['human face', 'rocket', 'helmet', 'american flag'];
24
+ const output = await detector(url, candidate_labels);
25
+ ```
26
+
27
  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:833a86ab14b5828e7a43a796648e83fc5cdf538eb2410ef828b4a28573450983
3
+ size 182206705
onnx/model_q4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53a2a52b65a77a5479aae280eaee38bea2417a380f3988a02fb04c4bc3e9c575
3
+ size 189988237
onnx/model_q4f16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5bbfe85862b748e380adde6e72cc95b75b2bce3ecf2ddc2af44f6548902612f8
3
+ size 126441660
onnx/model_uint8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e8a7640bb33cd519efd310e737264063baa02feb55187a472840dc65a4ce77ff
3
+ size 159187621