Update to Transformers.js v3.4
#6
by
Xenova
HF Staff
- opened
- README.md +4 -4
- config.json +5 -0
README.md
CHANGED
@@ -7,15 +7,15 @@ https://huggingface.co/BAAI/bge-m3 with ONNX weights to be compatible with Trans
|
|
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, as follows:
|
16 |
|
17 |
```js
|
18 |
-
import { pipeline } from '@
|
19 |
|
20 |
// Create a feature-extraction pipeline
|
21 |
const extractor = await pipeline('feature-extraction', 'Xenova/bge-m3');
|
@@ -40,7 +40,7 @@ console.log(embeddings.tolist()); // Convert embeddings to a JavaScript list
|
|
40 |
|
41 |
You can also use the model for retrieval. For example:
|
42 |
```js
|
43 |
-
import { pipeline, cos_sim } from '@
|
44 |
|
45 |
// Create a feature-extraction pipeline
|
46 |
const extractor = await pipeline('feature-extraction', 'Xenova/bge-m3');
|
|
|
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, as follows:
|
16 |
|
17 |
```js
|
18 |
+
import { pipeline } from '@huggingface/transformers';
|
19 |
|
20 |
// Create a feature-extraction pipeline
|
21 |
const extractor = await pipeline('feature-extraction', 'Xenova/bge-m3');
|
|
|
40 |
|
41 |
You can also use the model for retrieval. For example:
|
42 |
```js
|
43 |
+
import { pipeline, cos_sim } from '@huggingface/transformers';
|
44 |
|
45 |
// Create a feature-extraction pipeline
|
46 |
const extractor = await pipeline('feature-extraction', 'Xenova/bge-m3');
|
config.json
CHANGED
@@ -21,6 +21,11 @@
|
|
21 |
"pad_token_id": 1,
|
22 |
"position_embedding_type": "absolute",
|
23 |
"transformers_version": "4.37.2",
|
|
|
|
|
|
|
|
|
|
|
24 |
"type_vocab_size": 1,
|
25 |
"use_cache": true,
|
26 |
"vocab_size": 250002
|
|
|
21 |
"pad_token_id": 1,
|
22 |
"position_embedding_type": "absolute",
|
23 |
"transformers_version": "4.37.2",
|
24 |
+
"transformers.js_config": {
|
25 |
+
"use_external_data_format": {
|
26 |
+
"model.onnx": true,
|
27 |
+
}
|
28 |
+
},
|
29 |
"type_vocab_size": 1,
|
30 |
"use_cache": true,
|
31 |
"vocab_size": 250002
|