Xenova HF staff commited on
Commit
37894b8
·
1 Parent(s): eef3870

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/google/electra-small-discriminator 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/google/electra-small-discriminator 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/electra-small-discriminator`.
13
+
14
+ ```javascript
15
+ import { pipeline } from '@xenova/transformers';
16
+
17
+ // Create feature extraction pipeline
18
+ const extractor = await pipeline('feature-extraction', 'Xenova/electra-small-discriminator');
19
+
20
+ // Perform feature extraction
21
+ const output = await extractor('This is a test sentence.');
22
+ console.log(output)
23
+ // Tensor {
24
+ // dims: [ 1, 8, 256 ],
25
+ // type: 'float32',
26
+ // data: Float32Array(2048) [ 0.5410046577453613, 0.18386700749397278, ... ],
27
+ // size: 2048
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`).