CoolFace
Modelpublic

IsGarrido/flan-t5-gender-rewriter

sourceHugging Faceapache-2.0updated 10mo agoView on Hugging Face
0likes21downloads
Model Card

Gender Rewriter (FLAN-T5 Base)

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.

Usage

You MUST use the specific prefixes trained into the model:

  1. 1.rewrite male to female: [sentence]
  2. 2.rewrite female to male: [sentence]

Python Example

python
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."

Bias & Limitations

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:

  • —Rare gendered nouns (e.g., Duke/Duchess).
  • —Complex ambiguous pronouns in long paragraphs.