Update README.md
Browse files
README.md
CHANGED
@@ -6,4 +6,30 @@ pipeline_tag: translation
|
|
6 |
|
7 |
https://huggingface.co/facebook/mbart-large-50-many-to-many-mmt with ONNX weights to be compatible with Transformers.js.
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
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`).
|
|
|
6 |
|
7 |
https://huggingface.co/facebook/mbart-large-50-many-to-many-mmt with ONNX weights to be compatible with Transformers.js.
|
8 |
|
9 |
+
## Usage
|
10 |
+
|
11 |
+
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:
|
12 |
+
```bash
|
13 |
+
npm i @huggingface/transformers
|
14 |
+
```
|
15 |
+
|
16 |
+
```js
|
17 |
+
import { pipeline } from '@huggingface/transformers';
|
18 |
+
|
19 |
+
// Create translation pipeline
|
20 |
+
const translator = await pipeline('translation', 'Xenova/mbart-large-50-many-to-many-mmt');
|
21 |
+
|
22 |
+
// Translate text from Hindi to French
|
23 |
+
const output_hi = await translator('संयुक्त राष्ट्र के प्रमुख का कहना है कि सीरिया में कोई सैन्य समाधान नहीं है', {
|
24 |
+
src_lang: 'hi_IN', // Hindi
|
25 |
+
tgt_lang: 'fr_XX', // French
|
26 |
+
});
|
27 |
+
// [{ translation_text: 'Le chef des Nations affirme qu 'il n 'y a military solution in Syria.' }]
|
28 |
+
```
|
29 |
+
|
30 |
+
## Languages covered
|
31 |
+
Arabic (ar_AR), Czech (cs_CZ), German (de_DE), English (en_XX), Spanish (es_XX), Estonian (et_EE), Finnish (fi_FI), French (fr_XX), Gujarati (gu_IN), Hindi (hi_IN), Italian (it_IT), Japanese (ja_XX), Kazakh (kk_KZ), Korean (ko_KR), Lithuanian (lt_LT), Latvian (lv_LV), Burmese (my_MM), Nepali (ne_NP), Dutch (nl_XX), Romanian (ro_RO), Russian (ru_RU), Sinhala (si_LK), Turkish (tr_TR), Vietnamese (vi_VN), Chinese (zh_CN), Afrikaans (af_ZA), Azerbaijani (az_AZ), Bengali (bn_IN), Persian (fa_IR), Hebrew (he_IL), Croatian (hr_HR), Indonesian (id_ID), Georgian (ka_GE), Khmer (km_KH), Macedonian (mk_MK), Malayalam (ml_IN), Mongolian (mn_MN), Marathi (mr_IN), Polish (pl_PL), Pashto (ps_AF), Portuguese (pt_XX), Swedish (sv_SE), Swahili (sw_KE), Tamil (ta_IN), Telugu (te_IN), Thai (th_TH), Tagalog (tl_XX), Ukrainian (uk_UA), Urdu (ur_PK), Xhosa (xh_ZA), Galician (gl_ES), Slovene (sl_SI)
|
32 |
+
|
33 |
+
---
|
34 |
+
|
35 |
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`).
|