Update README.md
Browse files
README.md
CHANGED
|
@@ -1,10 +1,40 @@
|
|
| 1 |
---
|
| 2 |
language:
|
| 3 |
- en
|
| 4 |
-
-
|
| 5 |
metrics:
|
| 6 |
- f1
|
| 7 |
-
pipeline_tag: text2text-generation
|
| 8 |
tags:
|
| 9 |
-
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
language:
|
| 3 |
- en
|
| 4 |
+
pipeline_tag: text2text-generation
|
| 5 |
metrics:
|
| 6 |
- f1
|
|
|
|
| 7 |
tags:
|
| 8 |
+
- grammatical error correction
|
| 9 |
+
- GEC
|
| 10 |
+
- english
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
This is a fine-tuned version of LLAMA2 trained (7b) on spider, sql-create-context.
|
| 14 |
+
|
| 15 |
+
To initialize the model:
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
#from transformers import MBartForConditionalGeneration, MBart50TokenizerFast
|
| 19 |
+
#model = MBartForConditionalGeneration.from_pretrained("MRNH/mbart-english-grammar-corrector")
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
Use the tokenizer:
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
#tokenizer = MBart50TokenizerFast.from_pretrained("MRNH/mbart-english-grammar-corrector", src_lang="en_XX", tgt_lang="en_XX")
|
| 26 |
+
|
| 27 |
+
#input = tokenizer("I was here yesterday to studying",
|
| 28 |
+
# text_target="I was here yesterday to study", return_tensors='pt')
|
| 29 |
+
|
| 30 |
+
To generate text using the model:
|
| 31 |
+
|
| 32 |
+
#output = model.generate(input["input_ids"],attention_mask=input["attention_mask"],
|
| 33 |
+
# forced_bos_token_id=tokenizer_it.lang_code_to_id["en_XX"])
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
Training of the model is performed using the following loss computation based on the hidden state output h:
|
| 37 |
+
|
| 38 |
+
#h.logits, h.loss = model(input_ids=input["input_ids"],
|
| 39 |
+
# attention_mask=input["attention_mask"],
|
| 40 |
+
# labels=input["labels"])
|