multilingual-e5-small-aligned-sentiment

This model is a fine-tuned version of agentlans/multilingual-e5-small-aligned designed for assessing text sentiment across multiple languages.

Key Features

  • Multilingual support
  • Sentiment assessment for text
  • Based on E5 small model architecture

Intended Uses & Limitations

This model is intended for:

  • Assessing the sentiment of multilingual text
  • Filtering multilingual content
  • Comparative analysis of corpus text sentiment across different languages

Limitations:

  • Performance may vary for languages not well-represented in the training data
  • Should not be used as the sole criterion for sentiment assessment

Usage Example

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

model_name = "agentlans/multilingual-e5-small-aligned-sentiment"

# Initialize tokenizer and model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = model.to(device)

def sentiment(text):
    """Assess the sentiment of the input text."""
    inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True).to(device)
    with torch.no_grad():
        logits = model(**inputs).logits.squeeze().cpu()
    return logits.tolist()

# Example usage
score = sentiment("Your text here.")
print(f"Sentiment score: {score}")

Performance Results

The model was evaluated on a diverse set of multilingual text samples:

  • 10 English text samples of varying sentiment were translated into Arabic, Chinese, French, Russian, and Spanish.
  • The model demonstrated consistent sentiment assessment across different languages for the same text.
Click here for the 10 original texts and their translations.
Text English French Spanish Chinese Russian Arabic
A Nothing seems to go right, and I'm constantly frustrated. Rien ne semble aller bien et je suis constamment frustrรฉ. Nada parece ir bien y me siento constantemente frustrado. ไธ€ๅˆ‡ไผผไนŽ้ƒฝไธ้กบๅˆฉ๏ผŒๆˆ‘ๆ€ปๆ˜ฏๆ„Ÿๅˆฐๅพˆๆฒฎไธงใ€‚ ะšะฐะถะตั‚ัั, ะฒัะต ะธะดะตั‚ ะฝะต ั‚ะฐะบ, ะบะฐะบ ะฝะฐะดะพ, ะธ ั ะฟะพัั‚ะพัะฝะฝะพ ั€ะฐััั‚ั€ะพะตะฝ. ูŠุจุฏูˆ ุฃู† ู„ุง ุดูŠุก ูŠุณูŠุฑ ุนู„ู‰ ู…ุง ูŠุฑุงู…ุŒ ูˆุฃู†ุง ุฃุดุนุฑ ุจุงู„ุฅุญุจุงุท ุจุงุณุชู…ุฑุงุฑ.
B Everything is falling apart, and I can't see any way out. Tout sโ€™effondre et je ne vois aucune issue. Todo se estรก desmoronando y no veo ninguna salida. ไธ€ๅˆ‡้ƒฝๅดฉๆบƒไบ†๏ผŒๆˆ‘็œ‹ไธๅˆฐไปปไฝ•ๅ‡บ่ทฏใ€‚ ะ’ัะต ั€ัƒัˆะธั‚ัั, ะธ ั ะฝะต ะฒะธะถัƒ ะฒั‹ั…ะพะดะฐ. ูƒู„ ุดูŠุก ูŠู†ู‡ุงุฑุŒ ูˆู„ุง ุฃุณุชุทูŠุน ุฃู† ุฃุฑู‰ ุฃูŠ ู…ุฎุฑุฌ.
C I feel completely overwhelmed by the challenges I face. Je me sens complรจtement dรฉpassรฉ par les dรฉfis auxquels je suis confrontรฉ. Me siento completamente abrumado por los desafรญos que enfrento. ๆˆ‘ๆ„Ÿ่ง‰่‡ชๅทฑๅฎŒๅ…จ่ขซๆ‰€้ขไธด็š„ๆŒ‘ๆˆ˜ๅŽ‹ๅžฎไบ†ใ€‚ ะฏ ั‡ัƒะฒัั‚ะฒัƒัŽ ัะตะฑั ัะพะฒะตั€ัˆะตะฝะฝะพ ะฟะพะดะฐะฒะปะตะฝะฝั‹ะผ ะธะท-ะทะฐ ะฟั€ะพะฑะปะตะผ, ั ะบะพั‚ะพั€ั‹ะผะธ ะผะฝะต ะฟั€ะธั…ะพะดะธั‚ัั ัั‚ะฐะปะบะธะฒะฐั‚ัŒัั. ุฃุดุนุฑ ุจุฃู†ู†ูŠ ุบุงุฑู‚ ุชู…ุงู…ู‹ุง ููŠ ุงู„ุชุญุฏูŠุงุช ุงู„ุชูŠ ุฃูˆุงุฌู‡ู‡ุง.
D There are some minor improvements, but overall, things are still tough. Il y a quelques amรฉliorations mineures, mais dans lโ€™ensemble, les choses restent difficiles. Hay algunas mejoras menores, pero en general las cosas siguen siendo difรญciles. ่™ฝ็„ถๆœ‰ไธ€ไบ›ๅฐ็š„ๆ”น่ฟ›๏ผŒไฝ†ๆ˜ฏๆ€ป็š„ๆฅ่ฏด๏ผŒไบ‹ๆƒ…ไป็„ถๅพˆ่‰ฐ้šพใ€‚ ะ•ัั‚ัŒ ะฝะตะบะพั‚ะพั€ั‹ะต ะฝะตะทะฝะฐั‡ะธั‚ะตะปัŒะฝั‹ะต ัƒะปัƒั‡ัˆะตะฝะธั, ะฝะพ ะฒ ั†ะตะปะพะผ ัะธั‚ัƒะฐั†ะธั ะฟะพ-ะฟั€ะตะถะฝะตะผัƒ ัะปะพะถะฝะฐั. ู‡ู†ุงูƒ ุจุนุถ ุงู„ุชุญุณูŠู†ุงุช ุงู„ุทููŠูุฉุŒ ูˆู„ูƒู† ุจุดูƒู„ ุนุงู…ุŒ ู„ุง ุชุฒุงู„ ุงู„ุฃู…ูˆุฑ ุตุนุจุฉ.
E I can see a glimmer of hope amidst the difficulties I encounter. Je vois une lueur dโ€™espoir au milieu des difficultรฉs que je rencontre. Puedo ver un rayo de esperanza en medio de las dificultades que encuentro. ๆˆ‘ๅœจ้‡ๅˆฐ็š„ๅ›ฐ้šพไธญ็œ‹ๅˆฐไบ†ไธ€็บฟๅธŒๆœ›ใ€‚ ะกั€ะตะดะธ ั‚ั€ัƒะดะฝะพัั‚ะตะน, ั ะบะพั‚ะพั€ั‹ะผะธ ั ัั‚ะฐะปะบะธะฒะฐัŽััŒ, ั ะฒะธะถัƒ ะฟั€ะพะฑะปะตัะบ ะฝะฐะดะตะถะดั‹. ุฃุณุชุทูŠุน ุฃู† ุฃุฑู‰ ุจุตูŠุต ุฃู…ู„ ูˆุณุท ุงู„ุตุนูˆุจุงุช ุงู„ุชูŠ ุฃูˆุงุฌู‡ู‡ุง.
F Things are starting to look up, and I'm cautiously optimistic. Les choses commencent ร  sโ€™amรฉliorer et je suis prudemment optimiste. Las cosas estรกn empezando a mejorar y me siento cautelosamente optimista. ไบ‹ๆƒ…ๅผ€ๅง‹ๅฅฝ่ฝฌ๏ผŒๆˆ‘ๆŒ่ฐจๆ…Žไน่ง‚็š„ๆ€ๅบฆใ€‚ ะกะธั‚ัƒะฐั†ะธั ะฝะฐั‡ะธะฝะฐะตั‚ ัƒะปัƒั‡ัˆะฐั‚ัŒัั, ะธ ั ะฝะฐัั‚ั€ะพะตะฝ ะพัั‚ะพั€ะพะถะฝะพ ะธ ะพะฟั‚ะธะผะธัั‚ะธั‡ะฝะพ. ุจุฏุฃุช ุงู„ุฃู…ูˆุฑ ุชุชุฌู‡ ู†ุญูˆ ุงู„ุชุญุณู†ุŒ ูˆุฃู†ุง ู…ุชูุงุฆู„ ุจุญุฐุฑ.
G I'm feeling more positive about my situation than I have in a while. Je me sens plus positif ร  propos de ma situation que je ne lโ€™ai รฉtรฉ depuis un certain temps. Me siento mรกs positivo sobre mi situaciรณn que en mucho tiempo. ๆˆ‘ๅฏน่‡ชๅทฑๅค„ๅขƒ็š„ๆ„Ÿ่ง‰ๆฏ”ไปฅๅ‰ๆ›ดๅŠ ไน่ง‚ไบ†ใ€‚ ะฏ ั‡ัƒะฒัั‚ะฒัƒัŽ ัะตะฑั ะฑะพะปะตะต ะฟะพะทะธั‚ะธะฒะฝะพ ะพั‚ะฝะพัะธั‚ะตะปัŒะฝะพ ัะฒะพะตะน ัะธั‚ัƒะฐั†ะธะธ, ั‡ะตะผ ะบะพะณะดะฐ-ะปะธะฑะพ ะทะฐ ะฟะพัะปะตะดะฝะตะต ะฒั€ะตะผั. ุฃุดุนุฑ ุจุฅูŠุฌุงุจูŠุฉ ุฃูƒุจุฑ ุชุฌุงู‡ ูˆุถุนูŠ ู…ู‚ุงุฑู†ุฉ ุจุฃูŠ ูˆู‚ุช ู…ุถู‰.
H There are many good things happening, and I appreciate them. Il se passe beaucoup de bonnes choses et je les apprรฉcie. Estรกn sucediendo muchas cosas buenas y las aprecio. ๆœ‰ๅพˆๅคšๅฅฝไบ‹ๅ‘็”Ÿ๏ผŒๆˆ‘ๅฏนๆญค่กจ็คบๆ„Ÿ่ฐขใ€‚ ะŸั€ะพะธัั…ะพะดะธั‚ ะผะฝะพะณะพ ั…ะพั€ะพัˆะตะณะพ, ะธ ั ัั‚ะพ ั†ะตะฝัŽ. ู‡ู†ุงูƒ ุงู„ูƒุซูŠุฑ ู…ู† ุงู„ุฃุดูŠุงุก ุงู„ุฌูŠุฏุฉ ุงู„ุชูŠ ุชุญุฏุซุŒ ูˆุฃู†ุง ุฃู‚ุฏุฑู‡ุง.
I Every day brings new joy and possibilities; I feel truly blessed. Chaque jour apporte de nouvelles joies et possibilitรฉs ; je me sens vraiment bรฉni. Cada dรญa trae nueva alegrรญa y posibilidades; me siento verdaderamente bendecida. ๆฏๅคฉ้ƒฝๆœ‰ๆ–ฐ็š„ๅฟซไนๅ’Œๅฏ่ƒฝๆ€ง๏ผ›ๆˆ‘ๆ„Ÿๅˆฐ้žๅธธๅนธ็ฆใ€‚ ะšะฐะถะดั‹ะน ะดะตะฝัŒ ะฟั€ะธะฝะพัะธั‚ ะฝะพะฒัƒัŽ ั€ะฐะดะพัั‚ัŒ ะธ ะฒะพะทะผะพะถะฝะพัั‚ะธ; ั ั‡ัƒะฒัั‚ะฒัƒัŽ ัะตะฑั ะฟะพ-ะฝะฐัั‚ะพัั‰ะตะผัƒ ะฑะปะฐะณะพัะปะพะฒะตะฝะฝะพะน. ูƒู„ ูŠูˆู… ูŠุฌู„ุจ ูุฑุญุฉ ูˆุฅู…ูƒุงู†ูŠุงุช ุฌุฏูŠุฏุฉุ› ุฃุดุนุฑ ุจุฃู†ู†ูŠ ู…ุญุธูˆุธุฉ ุญู‚ู‹ุง.
J Life is full of opportunities, and I'm excited about the future. La vie est pleine dโ€™opportunitรฉs et je suis enthousiaste quant ร  lโ€™avenir. La vida estรก llena de oportunidades y estoy entusiasmado por el futuro. ็”Ÿๆดปๅ……ๆปกๆœบ้‡๏ผŒๆˆ‘ๅฏนๆœชๆฅๅ……ๆปกๅ…ดๅฅ‹ใ€‚ ะ–ะธะทะฝัŒ ะฟะพะปะฝะฐ ะฒะพะทะผะพะถะฝะพัั‚ะตะน, ะธ ั ั ะฝะตั‚ะตั€ะฟะตะฝะธะตะผ ะถะดัƒ ะฑัƒะดัƒั‰ะตะณะพ. ุงู„ุญูŠุงุฉ ู…ู„ูŠุฆุฉ ุจุงู„ูุฑุตุŒ ูˆุฃู†ุง ู…ุชุญู…ุณ ู„ู„ู…ุณุชู‚ุจู„.
Scatterplot of predicted sentiment scores grouped by text sample and language

Training Data

The model was trained on the Multilingual Parallel Sentences dataset, which includes:

  • Parallel sentences in English and various other languages
  • Semantic similarity scores calculated using LaBSE
  • Additional sentiment metrics
  • Sources: JW300, Europarl, TED Talks, OPUS-100, Tatoeba, Global Voices, and News Commentary

Training procedure

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 5e-05
  • train_batch_size: 128
  • eval_batch_size: 8
  • seed: 42
  • optimizer: Use adamw_torch with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
  • lr_scheduler_type: linear
  • num_epochs: 3.0

Training results

Training Loss Epoch Step Validation Loss Mse
0.1946 1.0 7813 0.1647 0.1647
0.1385 2.0 15626 0.1528 0.1528
0.1121 3.0 23439 0.1455 0.1455

Framework versions

  • Transformers 4.46.3
  • Pytorch 2.5.1+cu124
  • Datasets 3.1.0
  • Tokenizers 0.20.3
Downloads last month
774
Safetensors
Model size
0.1B params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for agentlans/multilingual-e5-small-aligned-sentiment

Finetuned
(4)
this model

Dataset used to train agentlans/multilingual-e5-small-aligned-sentiment