π Update README.md samples for Transformers.js v3
Browse files
README.md
CHANGED
@@ -8,13 +8,18 @@ https://huggingface.co/jinaai/jina-embeddings-v2-small-en with ONNX weights to b
|
|
8 |
|
9 |
## Usage with π€ Transformers.js
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
```js
|
12 |
-
|
13 |
-
import { pipeline, cos_sim } from '@xenova/transformers';
|
14 |
|
15 |
// Create feature extraction pipeline
|
16 |
const extractor = await pipeline('feature-extraction', 'Xenova/jina-embeddings-v2-small-en',
|
17 |
-
{
|
18 |
);
|
19 |
|
20 |
// Generate embeddings
|
|
|
8 |
|
9 |
## Usage with π€ 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 |
+
You can then use the model as follows:
|
17 |
```js
|
18 |
+
import { pipeline, cos_sim } from '@huggingface/transformers';
|
|
|
19 |
|
20 |
// Create feature extraction pipeline
|
21 |
const extractor = await pipeline('feature-extraction', 'Xenova/jina-embeddings-v2-small-en',
|
22 |
+
{ dtype: "fp32" } // Options: "fp32", "fp16", "q8", "q4"
|
23 |
);
|
24 |
|
25 |
// Generate embeddings
|