Downloads · 30 days
16
1% of all-time downloads
thefrigidliquidation/roberta-base-pronouns
roberta-base-pronouns is a fill-mask model from thefrigidliquidation. Use it when you need the model to fill a missing word. It is set up for transformers. The card lists the license as mit.
This is RoBERTa base fine-tuned for fill masking of just pronouns. The model's purpose is to post process machine translated text where sentence level translation may not have enough context to correctly deduce the co…
Downloads · 30 days
16
1% of all-time downloads
All-time downloads
1.1K
Public
Parameters
125M
998 MB on disk
Likes
0
Public
Click a slice to open those files.
.bin499 MB · 50%
How the weights are stored.
F32125M · 100%
From the Hugging Face model README
This is RoBERTa base fine-tuned for fill masking of just pronouns. The model's purpose is to post process machine translated text where sentence level translation may not have enough context to correctly deduce the correct pronoun to use.
This model was trained on 10B tokens of literature (private light novel and book dataset as well as books1 and 20% of books3 from The Pile).
This model achieves an 88% top1 accuracy, evaluated with a sliding window of 512 tokens (84% without a sliding window).
Use fix_pronouns_in_text from pronoun_fixer.py
from transformers import AutoModelForMaskedLM, AutoTokenizer, FillMaskPipeline
import pronoun_fixer
# text produced by sentence level machine translation where the pronoun was ambiguous in the source language
# and is wrong in the target language
MTL_TEXT = """
Cadence Lee thought he was a normal girl, perhaps a little well to do, but not exceptionally so.
"""
device = 'cuda'
pronoun_checkpoint = "thefrigidliquidation/roberta-base-pronouns"
pronoun_model = AutoModelForMaskedLM.from_pretrained(pronoun_checkpoint).to(device)
pronoun_tokenizer = AutoTokenizer.from_pretrained(pronoun_checkpoint)
unmasker = FillMaskPipeline(model=pronoun_model, tokenizer=pronoun_tokenizer, device=device, top_k=10)
fixed_text = pronoun_fixer.fix_pronouns_in_text(unmasker, pronoun_tokenizer, MTL_TEXT)
print(fixed_text)
# Cadence Lee thought she was a normal girl, perhaps a little well to do, but not exceptionally so.
# now the pronoun is fixed