Xenova HF staff commited on
Commit
f44b5f5
·
1 Parent(s): 990d0e4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +27 -0
README.md CHANGED
@@ -4,4 +4,31 @@ library_name: transformers.js
4
 
5
  https://huggingface.co/YituTech/conv-bert-medium-small with ONNX weights to be compatible with Transformers.js.
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using [🤗 Optimum](https://huggingface.co/docs/optimum/index) and structuring your repo like this one (with ONNX weights located in a subfolder named `onnx`).
 
4
 
5
  https://huggingface.co/YituTech/conv-bert-medium-small with ONNX weights to be compatible with Transformers.js.
6
 
7
+ 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/@xenova/transformers) using:
8
+ ```bash
9
+ npm i @xenova/transformers
10
+ ```
11
+
12
+ **Example:** Feature extraction w/ `Xenova/conv-bert-medium-small`.
13
+
14
+ ```javascript
15
+ import { pipeline } from '@xenova/transformers';
16
+
17
+ // Create feature extraction pipeline
18
+ const classifier = await pipeline('feature-extraction', 'Xenova/conv-bert-medium-small', { quantized: false });
19
+
20
+ // Perform feature extraction
21
+ const output = await classifier('This is a test sentence.');
22
+ console.log(output)
23
+ // Tensor {
24
+ // dims: [ 1, 8, 384 ],
25
+ // type: 'float32',
26
+ // data: Float32Array(3072) [ 0.5316754579544067, 0.5101212859153748, ... ],
27
+ // size: 3072
28
+ // }
29
+ ```
30
+
31
+ ---
32
+
33
+
34
  Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using [🤗 Optimum](https://huggingface.co/docs/optimum/index) and structuring your repo like this one (with ONNX weights located in a subfolder named `onnx`).