Downloads · 30 days
12
2% of all-time downloads
thebogko/mt5-finetuned-bulgarian-grammar-mistakes
mt5-finetuned-bulgarian-grammar-mistakes is a text generation model from thebogko. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This model is a fine-tune checkpoint of mt5-base, fine-tuned on bulgarian-grammar-mistakes by only taking into account two of the four error types: - articlemisuse, and - pronounmisuse This is done so the model can fo…
Downloads · 30 days
12
2% of all-time downloads
All-time downloads
528
Public
Parameters
582M
2.4 GB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors2.3 GB · 99%
From the Hugging Face model README
This model is a fine-tune checkpoint of mt5-base, fine-tuned on bulgarian-grammar-mistakes by only taking into account two of the four error types:
Intended use of the model includes but is not limited to:
No need to fine-tuning further, unless needing to add more error types.
The model should not be used to intentionally create hostile or alienating environments for people - especially Bulgarian learners. In addition, the model was not trained to be factual or true representations of people or events, and therefore using the model to generate such content is out-of-scope for the abilities of this model.
The model specialises in identifying and correcting Bulgarian grammar errors that have to do with article and pronoun misuse, so it will likely not perform well on other types of errors. Additionally, the dataset used for fine-tuning does not encompass all possible errors of those types, so use should be with caution of grammatical validity of output.
Users are strongly advised to double check the validity of the model's outputs and to strive to understand the underlying grammatical rules behind the language, instead of using the model's outputs as given.
Use the code below to get started with the model.
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("thebogko/mt5-finetuned-bulgarian-grammar-mistakes")
model = AutoModelForSeq2SeqLM.from_pretrained("thebogko/mt5-finetuned-bulgarian-grammar-mistakes")
erroneous_sentence = 'Владетеля умря още млад.'
encoded_source = tokenizer(erroneous_sentence,
return_tensors='pt',
max_length=100,
padding='max_length')
encoded_source.to(device)
correct_sentence = ft_model.generate(**encoded_source, max_length=100)
correct_sentence = [tokenizer.decode(t, skip_special_tokens=True) for t in correct_sentence][0]
print(correct_sentence)
"Владетелят умря още млад."
The training data used is from a collection of Bulgarian grammar mistakes, which contains 7.59k rows of data, spanning over four different types of grammar errors:
Only the first two were used in the fine-tuning of this model, as the rationale was that these two types of errors are much more common overall (especially with native Bulgarian speakers), and it would allow the model to focus on these.
After filtering only these two types we are left with 3090 pairs, which were then split into training/validation/test (72/18/10), respectively. With this split we are left with 2224 training pairs.
The standard fine-tuning training procedure was applied by creating batches from the training samples and evaluating on each epoch. The model weights are optimised using cross-entropy loss.
Gridspace search was applied to find the best learning rate, epoch number, weight decay and batch size. The gridspace searched is as follows:
gridSpace = {
'batch_size': [4, 8],
'lr_rate': [0.002, 0.0002, 0.00002],
'w_decay': [0.1, 0.01, 0.001]
}
Along with an epoch number from 1 to 16.
The chosen setup at the end of experimentation stage was chosen to be:
This gridspace search was performed 3 separate times, and it resulted in the lowest average validation loss of 0.01431.
Evaluation was performed against four other models:
The testing data is 309 pairs, from the original train/validation/test split of (72/18/10) over 3090 pairs.
Evaluated using recall, precision, f1 score, f0.5 score and BLEU.
The resuls are averaged over the testing pairs.
mt5-base finetuned bulgarian-grammar-mistakes:
gpt3.5 Turbo
BgGPT
RNN encoder-decoder model with attention
The evaluation showcases that the fine-tuned model ourperforms all other models across the chosen metrics, particularly precision. This implies that the model's strength lies in being able to ensure that the corrections it makes are, in fact, valid, as opposed to the other models, all of which exhibit a recall value that's much higher than their respective precision.
<!-- ## Citation [optional] **BibTeX:** [More Information Needed] **APA:** [More Information Needed] ## Glossary [optional] [More Information Needed] ## More Information [optional] [More Information Needed] ## Model Card Authors [optional] [More Information Needed] ## Model Card Contact [More Information Needed]-->