Downloads · 30 days
0
mohamedmostafa259/bart-emoji-translator
bart-emoji-translator is a translation model from mohamedmostafa259. Use it when you need text moved from one language to another. It is set up for transformers. The card lists the license as apache-2.0.
A fine-tuned BART model that translates English text to emoji sequences using curriculum learning and LoRA.
Downloads · 30 days
0
Access
Public
Updated Nov 21, 2025
Repo size
151 MB
Likes
2
Public
Click a slice to open those files.
.safetensors151 MB · 99%
From the Hugging Face model README
A fine-tuned BART model that translates English text to emoji sequences using curriculum learning and LoRA.
This model converts natural language text into appropriate emoji representations. It was trained using a 6-stage curriculum learning approach with custom data retention strategies.
Base Model: facebook/bart-large
Training Method: LoRA (Low-Rank Adaptation)
from transformers import BartTokenizer, BartForConditionalGeneration
from peft import PeftModel
# Load model
base_model = BartForConditionalGeneration.from_pretrained("facebook/bart-large")
model = PeftModel.from_pretrained(base_model, "mohamedmostafa259/bart-emoji-translator")
tokenizer = BartTokenizer.from_pretrained("mohamedmostafa259/bart-emoji-translator")
# Translate text to emojis
def translate(
text: str,
max_length: int = 32,
num_beams: int = 1,
do_sample: bool = True,
temperature: float = 1.0,
top_p: float = 0.4,
top_k: int = 50
) -> str:
inputs = tokenizer(text, return_tensors="pt")
outputs = model.generate(
**inputs,
max_length=max_length,
num_beams=num_beams,
do_sample=do_sample,
temperature=temperature,
top_p=top_p,
top_k=top_k
)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
# Examples
print(translate('I am happy.')) # 😁🤘
print(translate('I feel misunderstood.')) # 🤬😬
print(translate('My parents want to have a new baby.')) # 👶🤰👪
print(translate('I eat dinner with my family.')) # 🥪🥛👪
This model uses sampling-based decoding (temperature and nucleus sampling) rather than deterministic beam search. As a result, the same input may occasionally produce slightly different emoji sequences across runs. This behavior is expected and reflects the model choosing between multiple valid emoji interpretations for a given sentence.
The model was trained using a 6-phase curriculum learning approach with strategic data retention:
| Phase | Current Stage | Previous Stages Included |
|---|---|---|
| Phase 1 (bootstrap) | Stage 1 (100%) | None |
| Phase 2 | Stage 2 (100%) | None (Stage 1 dropped) |
| Phase 3 | Stage 3 (100%) | Stage 2 (33%) |
| Phase 4 | Stage 4 (100%) | Stage 3 (50%), Stage 2 (33%) |
| Phase 5 | Stage 5 (100%) | Stage 4 (50%), Stage 3 (50%), Stage 2 (33%) |
| Phase 6 | Stage 6 (100%) | Stage 5 (50%), Stage 4 (50%), Stage 3 (50%), Stage 2 (33%) |
The curriculum is structured around emoji count, progressively increasing output complexity:
Phase 1 (Single Emoji Foundation): Simple phrases mapping to one emoji
"I feel very happy" → 😄"You pour some wine" → 🍷Phase 2 (Two Emojis): Basic two-concept expressions
"They move to the rhythm" → 🎵 💃"I like to drink wine" → ❤️ 🍷Phase 3 (Three Emojis): Short sentences with three distinct concepts
"He makes money selling his Islamic art" → 🤑 ☪️ 🎨"We looked for the eagle and llama on the map" → 🦅 🦙 🗺️Phase 4 (Four Emojis): Longer phrases with multiple related concepts
"We took the car to see the nature scenery" → 🚗 ⛰️ 🌲 🏞️"He made breakfast with eggs and toast" → 🍳 🍞 🥛 😋Phase 5 (Five Emojis): Complex sentences requiring sequential emoji representations
"The breakfast included eggs cheese bread and fresh milk" → 🥚 🧀 🍞 🥛 😋"The bar served wine champagne beer and whiskey all night" → 🍷 🥂 🍾 🍺 🥃Phase 6 (Six+ Emojis): Complex narratives with action sequences and multiple events
"Board plane pack luggage reach beach swim drink coconut milk nap" → ✈️ 🧳 🏝️ 🏊 🥥 😴"Man in suit and woman in dress drink wine eat noodles listen to music get engaged" → 🤵 👗 🍷 🍜 🎵 💍This emoji-count-based curriculum allows the model to:
If you use this model, please cite:
@misc{bart-emoji-translator,
author = {mohamedmostafa259},
title = {BART Emoji Translator},
year = {2025},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/mohamedmostafa259/bart-emoji-translator}}
}