whitphx HF Staff commited on
Commit
7ee3dec
Β·
verified Β·
1 Parent(s): 9561d1d

πŸ“ Update README.md samples for Transformers.js v3

Browse files
Files changed (1) hide show
  1. README.md +8 -3
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
- // npm i @xenova/transformers
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
- { quantized: false } // Comment out this line to use the quantized version
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