Update README.md
Browse files
README.md
CHANGED
@@ -4,4 +4,26 @@ library_name: transformers.js
|
|
4 |
|
5 |
https://huggingface.co/facebook/hubert-large-ls960-ft 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/facebook/hubert-large-ls960-ft with ONNX weights to be compatible with Transformers.js.
|
6 |
|
7 |
+
## Usage (Transformers.js)
|
8 |
+
|
9 |
+
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:
|
10 |
+
```bash
|
11 |
+
npm i @xenova/transformers
|
12 |
+
```
|
13 |
+
|
14 |
+
**Example:** Perform automatic speech recognition with `Xenova/hubert-large-ls960-ft`.
|
15 |
+
```javascript
|
16 |
+
import { pipeline } from '@xenova/transformers';
|
17 |
+
|
18 |
+
// Create automatic speech recognition pipeline
|
19 |
+
const transcriber = await pipeline('automatic-speech-recognition', 'Xenova/hubert-large-ls960-ft');
|
20 |
+
|
21 |
+
// Transcribe audio
|
22 |
+
const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav';
|
23 |
+
const output = await transcriber(url);
|
24 |
+
// { text: 'AND SO MY FELLOW AMERICA ASK NOT WHAT YOUR COUNTRY CAN DO FOR YOU ASK WHAT YOU CAN DO FOR YOUR COUNTRY' }
|
25 |
+
|
26 |
+
```
|
27 |
+
|
28 |
+
---
|
29 |
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`).
|