Update README.md
Browse files
README.md
CHANGED
|
@@ -18,12 +18,13 @@ To initialize the model:
|
|
| 18 |
from transformers import MBartForConditionalGeneration, MBart50TokenizerFast
|
| 19 |
model = MBartForConditionalGeneration.from_pretrained("MRNH/mbart-german-grammar-corrector")
|
| 20 |
|
| 21 |
-
|
| 22 |
-
To generate text using the model:
|
| 23 |
|
| 24 |
-
|
| 25 |
tokenizer = MBart50TokenizerFast.from_pretrained("MRNH/mbart-german-grammar-corrector", src_lang="de_DE", tgt_lang="de_DE")
|
| 26 |
input = tokenizer("I was here yesterday to studying",text_target="I was here yesterday to study", return_tensors='pt')
|
|
|
|
|
|
|
|
|
|
| 27 |
output = model.generate(input["input_ids"],attention_mask=input["attention_mask"],forced_bos_token_id=tokenizer_it.lang_code_to_id["de_DE"])
|
| 28 |
|
| 29 |
|
|
|
|
| 18 |
from transformers import MBartForConditionalGeneration, MBart50TokenizerFast
|
| 19 |
model = MBartForConditionalGeneration.from_pretrained("MRNH/mbart-german-grammar-corrector")
|
| 20 |
|
| 21 |
+
Use the tokenizer:
|
|
|
|
| 22 |
|
|
|
|
| 23 |
tokenizer = MBart50TokenizerFast.from_pretrained("MRNH/mbart-german-grammar-corrector", src_lang="de_DE", tgt_lang="de_DE")
|
| 24 |
input = tokenizer("I was here yesterday to studying",text_target="I was here yesterday to study", return_tensors='pt')
|
| 25 |
+
|
| 26 |
+
To generate text using the model:
|
| 27 |
+
|
| 28 |
output = model.generate(input["input_ids"],attention_mask=input["attention_mask"],forced_bos_token_id=tokenizer_it.lang_code_to_id["de_DE"])
|
| 29 |
|
| 30 |
|