Update README.md
Browse files
README.md
CHANGED
@@ -3,7 +3,34 @@ license: mit
|
|
3 |
base_model:
|
4 |
- sentence-transformers/msmarco-distilbert-cos-v5
|
5 |
---
|
6 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
Converted Using [Xenova](https://github.com/xenova/transformers.js/blob/main/scripts/convert.py)
|
9 |
|
|
|
3 |
base_model:
|
4 |
- sentence-transformers/msmarco-distilbert-cos-v5
|
5 |
---
|
6 |
+
# Usage using Transformer.js for feature extraction
|
7 |
+
|
8 |
+
```
|
9 |
+
import { env, pipeline } from "@xenova/transformers";
|
10 |
+
|
11 |
+
env.allowLocalModels = false;
|
12 |
+
|
13 |
+
const extractor = await pipeline(
|
14 |
+
"feature-extraction",
|
15 |
+
"Fuzail22/onnx-msmarco-distilbert-cos-v5",
|
16 |
+
{
|
17 |
+
quantized: false
|
18 |
+
}
|
19 |
+
);
|
20 |
+
|
21 |
+
const extract = async (text: string) => {
|
22 |
+
const output = await extractor(text, {
|
23 |
+
pooling: "mean",
|
24 |
+
normalize: true
|
25 |
+
});
|
26 |
+
console.log("extraction output:", output);
|
27 |
+
};
|
28 |
+
|
29 |
+
extact("Open Source is great!")
|
30 |
+
|
31 |
+
```
|
32 |
+
|
33 |
+
> This is Onnx converted version of the original model
|
34 |
|
35 |
Converted Using [Xenova](https://github.com/xenova/transformers.js/blob/main/scripts/convert.py)
|
36 |
|