Xenova HF Staff whitphx HF Staff commited on
Commit
76d7151
·
verified ·
1 Parent(s): 12b05a2

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

Browse files

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


Co-authored-by: Yuichiro Tachibana <[email protected]>

README.md CHANGED
@@ -5,4 +5,21 @@ library_name: transformers.js
5
 
6
  https://huggingface.co/microsoft/swin-tiny-patch4-window7-224 with ONNX weights to be compatible with Transformers.js.
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  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`).
 
5
 
6
  https://huggingface.co/microsoft/swin-tiny-patch4-window7-224 with ONNX weights to be compatible with Transformers.js.
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:** Classify an image.
16
+
17
+ ```js
18
+ import { pipeline } from '@huggingface/transformers';
19
+
20
+ const classifier = await pipeline('image-classification', 'Xenova/swin-tiny-patch4-window7-224');
21
+ const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg';
22
+ const output = await classifier(url);
23
+ ```
24
+
25
  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:b3f68adc05b708f5b7f84d35751b65892d88d20ae3c792d1585d64ec807c49b3
3
+ size 20989779
onnx/model_q4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0c379d5df9af7a6ee7630db40bb539b9be279975aebaf11a960d90eb63ad059b
3
+ size 22703429
onnx/model_q4f16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62db182545cf80a0d3e97ccf6affbb5fe7f70da5014ebdf4034412f0a335a892
3
+ size 18650093
onnx/model_uint8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4392fc9f08e09f418818a76717bcb6f5c97d6f5846e343f530e15b51676a8fd4
3
+ size 30766123