root
commited on
Commit
·
94f1dbe
1
Parent(s):
6594c13
Update readme
Browse files
README.md
CHANGED
@@ -1,12 +1,6 @@
|
|
1 |
# Model Name
|
2 |
|
3 |
-
This is a multilingually fine-tuned version of NLLB based on [nllb-200-distilled-600M](https://huggingface.co/facebook/nllb) using the text data of MuST-C v1.0 (En -> 8).
|
4 |
-
|
5 |
-
## Model Description
|
6 |
-
|
7 |
-
- **Model Type**: Sequence-to-Sequence
|
8 |
-
- **Languages Supported**: [List of languages]
|
9 |
-
- **Fine-tuning Data**: [Description of your dataset]
|
10 |
|
11 |
## Usage
|
12 |
|
@@ -16,9 +10,16 @@ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
|
16 |
tokenizer = AutoTokenizer.from_pretrained("johntsi/nllb-200-distilled-600M_mustc_en-to-8")
|
17 |
model = AutoModelForSeq2SeqLM.from_pretrained("johntsi/nllb-200-distilled-600M_mustc_en-to-8")
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
translated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
23 |
print(translated_text)
|
24 |
```
|
|
|
1 |
# Model Name
|
2 |
|
3 |
+
This is a multilingually fine-tuned version of [NLLB](https://arxiv.org/abs/2207.04672) based on [nllb-200-distilled-600M](https://huggingface.co/facebook/nllb-200-distilled-600M) using the text data of MuST-C v1.0 (En -> 8).
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
## Usage
|
6 |
|
|
|
10 |
tokenizer = AutoTokenizer.from_pretrained("johntsi/nllb-200-distilled-600M_mustc_en-to-8")
|
11 |
model = AutoModelForSeq2SeqLM.from_pretrained("johntsi/nllb-200-distilled-600M_mustc_en-to-8")
|
12 |
|
13 |
+
model.eval()
|
14 |
+
model.to("cuda")
|
15 |
+
|
16 |
+
text = "Translate this text to German."
|
17 |
+
inputs = tokenizer(text, return_tensors="pt").to("cuda")
|
18 |
+
outputs = model.generate(
|
19 |
+
**inputs,
|
20 |
+
num_beams=5,
|
21 |
+
forced_bos_token_id=tokenizer.lang_code_to_id["deu_Latn"]
|
22 |
+
)
|
23 |
translated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
24 |
print(translated_text)
|
25 |
```
|