Add/update the quantized ONNX model files and README.md for Transformers.js v3
#1
by whitphx - opened
- README.md +5 -5
- onnx/model_bnb4.onnx +3 -0
- onnx/model_int8.onnx +3 -0
- onnx/model_q4.onnx +3 -0
- onnx/model_q4f16.onnx +3 -0
- onnx/model_uint8.onnx +3 -0
README.md
CHANGED
|
@@ -7,19 +7,19 @@ https://huggingface.co/WhereIsAI/UAE-Large-V1 with ONNX weights to be compatible
|
|
| 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 |
You can then use the model to compute embeddings like this:
|
| 16 |
|
| 17 |
```js
|
| 18 |
-
import { pipeline } from '@
|
| 19 |
|
| 20 |
// Create a feature-extraction pipeline
|
| 21 |
const extractor = await pipeline('feature-extraction', 'Xenova/UAE-Large-V1', {
|
| 22 |
-
|
| 23 |
});
|
| 24 |
|
| 25 |
// Compute sentence embeddings
|
|
@@ -36,7 +36,7 @@ console.log(output);
|
|
| 36 |
|
| 37 |
Compute cosine similarity between the two sentences:
|
| 38 |
```js
|
| 39 |
-
import { cos_sim } from '@
|
| 40 |
console.log(cos_sim(output[0].data, output[1].data))
|
| 41 |
// 0.9586893906734091
|
| 42 |
```
|
|
|
|
| 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 |
You can then use the model to compute embeddings like this:
|
| 16 |
|
| 17 |
```js
|
| 18 |
+
import { pipeline } from '@huggingface/transformers';
|
| 19 |
|
| 20 |
// Create a feature-extraction pipeline
|
| 21 |
const extractor = await pipeline('feature-extraction', 'Xenova/UAE-Large-V1', {
|
| 22 |
+
dtype: "fp32" // Options: "fp32", "fp16", "q8", "q4"
|
| 23 |
});
|
| 24 |
|
| 25 |
// Compute sentence embeddings
|
|
|
|
| 36 |
|
| 37 |
Compute cosine similarity between the two sentences:
|
| 38 |
```js
|
| 39 |
+
import { cos_sim } from '@huggingface/transformers';
|
| 40 |
console.log(cos_sim(output[0].data, output[1].data))
|
| 41 |
// 0.9586893906734091
|
| 42 |
```
|
onnx/model_bnb4.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8180bdf448880cf623e5fbb806c53b37e0f58b694709ed086d171862e30fe817
|
| 3 |
+
size 298852122
|
onnx/model_int8.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:636207e6491b393f4acd3000b093aac57b7877b9ccba20d94db474addc5b2a13
|
| 3 |
+
size 335783482
|
onnx/model_q4.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1fa7c83e8b21e324f49df582e6ee7a4236856b392eb9ce5e3f429887428b760b
|
| 3 |
+
size 317725314
|
onnx/model_q4f16.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fa3be3b61f08f16839801110ba67e1c7defefd341d8cc17f1192abe8b2fe5aff
|
| 3 |
+
size 234646268
|
onnx/model_uint8.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:efc272790604c1cd4461d2791405de9f572a677b57d661f05175c0fdb7ef9e82
|
| 3 |
+
size 335783547
|