Downloads · 30 days
12
17% of all-time downloads
IsGarrido/flan-t5-gender-rewriter
flan-t5-gender-rewriter is a text generation model from IsGarrido. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
This model is a fine-tuned version of google/flan-t5-base specialized in gender rewriting. It can translate a sentence from a Male context to a Female context (and vice versa) while preserving the original meaning and…
Downloads · 30 days
12
17% of all-time downloads
All-time downloads
72
Public
Parameters
248M
991 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors990 MB · 100%
From the Hugging Face model README
This model is a fine-tuned version of google/flan-t5-base specialized in gender rewriting.
It can translate a sentence from a Male context to a Female context (and vice versa) while preserving the original meaning and structure.
You MUST use the specific prefixes trained into the model:
rewrite male to female: [sentence]rewrite female to male: [sentence]from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("IsGarrido/flan-t5-gender-rewriter")
model = AutoModelForSeq2SeqLM.from_pretrained("IsGarrido/flan-t5-gender-rewriter")
input_text = "rewrite male to female: He is a bachelor living in the city."
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
outputs = model.generate(input_ids, max_new_tokens=128)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
# Output: "She is a bachelorette living in the city."
This model was trained on synthetic data filtered by a BERT classifier. While it attempts to handle reflexives (himself/herself) and some professional titles, it may still struggle with: