π Update README.md samples for Transformers.js v3
#1
by
whitphx
HF Staff
- opened
README.md
CHANGED
@@ -5,4 +5,17 @@ library_name: transformers.js
|
|
5 |
|
6 |
https://huggingface.co/openai/whisper-tiny with ONNX weights to be compatible with Transformers.js.
|
7 |
|
8 |
-
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`).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
https://huggingface.co/openai/whisper-tiny with ONNX weights to be compatible with Transformers.js.
|
7 |
|
8 |
+
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`).
|
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 as follows:
|
16 |
+
```js
|
17 |
+
import { pipeline } from '@huggingface/transformers';
|
18 |
+
|
19 |
+
// Create the pipeline
|
20 |
+
const pipe = await pipeline('automatic-speech-recognition', 'whitphx/test-transformersjs-whisper-tiny');
|
21 |
+
```
|