CoolFace
Modelpublic

KafeisM/t5-small-pirate-style

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

t5-small-pirate-style ๐Ÿดโ€โ˜ ๏ธ

This model is a fine-tuned version of t5-small on the KafeisM/pirate-speak-dataset. It specializes in Style Transfer, rewriting standard Modern English text into stereotypical Pirate English.

It achieves the following results on the evaluation set:

  • โ€”Loss: 0.1254
  • โ€”Rouge1: 0.8776
  • โ€”Bleu: 0.8680

Model Description

  • โ€”Model type: T5 (Text-to-Text Transfer Transformer) esquemat5
  • โ€”Language(s): English (Modern & Pirate Style)
  • โ€”Task: Sequence-to-Sequence (Style Transfer)
  • โ€”Finetuning approach: Supervised Fine-Tuning with Seq2SeqTrainer.

This model was developed as an academic project for a "Deep Learning for NLP" course. It demonstrates how a small, general-purpose model like T5-small can be adapted to a specific niche domain using a small, high-quality synthetic dataset.

Intended Uses & Limitations

How to use

You must use the prefix translate English to Pirate: for the model to work correctly.

python
from transformers import pipeline

pipe = pipeline("text2text-generation", model=("KafeisM/t5-small-pirate-style"))

def translate_to_pirate(text):
    input_text = "translate English to Pirate: " + text
    inputs = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")

    outputs = model.generate(inputs, max_length=64, num_beams=4, early_stopping=True)
    return tokenizer.decode(outputs[0], skip_special_tokens=True)


print(translate_to_pirate("The server is down."))
print(translate_to_pirate("Hello friend, can you help me?"))
print(translate_to_pirate("I need to sleep now."))

# Output: "The server is down, matey."
# Output: "Hallo, friend, can ye help me?"
# Output: "I need to sleep now, matey.

Limitations and Bias

  • โ€”Synthetic Data: The model was trained on ~500 synthetic examples generated by an LLM. It mimics stereotypical pirate speech (Hollywood style), not historical maritime dialect.
  • โ€”Modern Vocabulary: As observed in stress testing, the model struggles with complex modern terms (e.g., "Quantum mechanics", "drivers"). It tends to employ a "conservative copying" strategy: preserving the noun and appending a pirate suffix (e.g., ", matey").
  • โ€”Repetition: The model has a learned bias towards ending sentences with specific catchphrases like ", matey" or ", arr".

Training and Evaluation Data

The model was trained on KafeisM/pirate-speak-dataset, a corpus of 500 English-Pirate pairs generated specifically for this project to ensure domain consistency.

  • โ€”Train split: 450 examples (90%).
  • โ€”Test split: 50 examples (10%).

Training Procedure

Training hyperparameters

The following hyperparameters were used during training:

  • โ€”learning_rate: 0.0002
  • โ€”train_batch_size: 16
  • โ€”eval_batch_size: 16
  • โ€”seed: 42
  • โ€”optimizer: AdamW
  • โ€”lr_scheduler_type: linear
  • โ€”num_epochs: 5
  • โ€”fp16: False (Trained on T4 GPU)

Training results

EpochTraining LossValidation LossRouge1Bleu
1.0No log0.66600.0*0.0*
2.0No log0.22540.70160.6968
3.0No log0.15440.80050.8027
4.0No log0.13260.87010.8647
5.0No log0.12540.87760.8680

Note: The 0.0 scores in Epoch 1 were due to an initial configuration behavior where the model generated empty strings or padding tokens, which was resolved as the model converged in subsequent epochs.

Framework versions

  • โ€”Transformers 4.57.1
  • โ€”Pytorch 2.9.0+cu126
  • โ€”Datasets 4.0.0
  • โ€”Tokenizers 0.22.1