Tanaos – Train task specific LLMs without training data, for offline NLP and Text Classification

tanaos-emotion-detection-v1: A small but performant emotion detection model

This model was created by Tanaos with the Artifex Python library.

This is an emotion detection model based on microsoft/Multilingual-MiniLM-L12-H384 and fine-tuned on a synthetic dataset to classify the main emotion expressed in any text input into one of the following categories:

Label Description
joy Text that expresses happiness or positivity
anger Text that expresses anger or frustration
fear Text that expresses fear or anxiety
sadness Text that expresses sadness or sorrow
surprise Text that expresses surprise or shock
disgust Text that expresses disgust or revulsion
excitement Text that expresses excitement or enthusiasm
neutral Text that either expresses a neutral or indifferent emotion, or that does not express any emotion at all on account of being purely factual or descriptive

neutral is the default label for text that is either factual or does not express a clear emotion.

These categories were chosen to cover a wide range of common emotions in text, in order to create a versatile and general-purpose emotion detection model, applicable across various industries and use cases.

This model can be used to analyze customer feedback, social media posts, reviews, and other text data to gain insights into the emotional tone and sentiment expressed by users.

While the default language is English, this model can be fine-tuned to any language. See the fine tune to any language section below for more details.

How to Use

Via the Artifex library (pip install artifex)

from artifex import Artifex

emotion_detection = Artifex().emotion_detection

print(emotion_detection("I can't wait for the concert tonight!"))
# >>> [{'label': 'excitement', 'score': 0.9941}]

Via the Transformers library

from transformers import pipeline

clf = pipeline("text-classification", model="tanaos/tanaos-emotion-detection-v1")

print(clf("I can't wait for the concert tonight!"))
# >>> [{'label': 'excitement', 'score': 0.9941}]

How to fine-tune (without training data)

Use the Artifex library to fine-tune the model to any language other than English, to custom domains or emotion categories by generating synthetic training data on-the-fly. Install Artifex with

pip install artifex

Fine-tune to any language

from artifex import Artifex

emotion_detection = Artifex().emotion_detection

model_output_path = "./output_model/"

emotion_detection.train(
    domain="soporte al cliente en Español para una plataforma de comercio electrónico", # change to your desired language
    classes={ # define your custom emotions in the target language
        "joy": "texto que expresa felicidad o positividad",
        "anger": "texto que expresa ira o frustración",
        "sadness": "texto que expresa tristeza o aflicción",
        "surprise": "texto que expresa sorpresa o impacto",
        "disgust": "texto que expresa disgusto o repulsión",
        "excitement": "texto que expresa entusiasmo o emoción",
        "neutral": "texto que expresa una emoción neutral o indiferente, o que no expresa ninguna emoción por ser puramente factual o descriptivo"
    },
    output_path=model_output_path
)

emotion_detection.load(model_output_path)
print(emotion_detection("Esto es inaceptable, quiero un reembolso."))

# >>> [{'label': 'anger', 'score': 0.9965}]

Fine-tune to custom emotion categories or domains

from artifex import Artifex

emotion_detection = Artifex().emotion_detection

model_output_path = "./output_model/"

emotion_detection.train(
    domain="travel reviews posted online", # change to your desired domain
    classes={ # define your custom emotions
        "happiness": "text that expresses delight or positivity",
        "anger": "text that expresses anger or frustration",
        "annoyance": "text that expresses mild irritation or annoyance",
        "frustration": "text that expresses a stronger sense of frustration or dissatisfaction",
        "neutral": "text that either expresses a neutral or indifferent emotion, or that does not express any emotion at all on account of being purely factual or descriptive."
    },
    output_path=model_output_path
)

emotion_detection.load(model_output_path)
print(emotion_detection("The hotel staff were somewhat rude, which ruined my stay a bit."))

# >>> [{'label': 'annoyance', 'score': 0.9965}]

Model Description

  • Base model: microsoft/Multilingual-MiniLM-L12-H384
  • Task: Text classification (emotion detection)
  • Languages: English (fine-tuneable to any language, see the fine tune to any language section)
  • Fine-tuning data: A synthetic, custom dataset of 10,000 utterances, each belonging to one of 12 different emotion categories.

Training Details

This model was trained using the Artifex Python library

pip install artifex

by providing the following instructions and generating 10,000 synthetic training samples:

from artifex import Artifex

ed = Artifex().emotion_detection

ed.train(
    domain="general",
    classes={
        "joy": "text that expresses happiness or positivity",
        "anger": "text that expresses anger or frustration",
        "fear": "text that expresses fear or anxiety",
        "sadness": "text that expresses sadness or sorrow",
        "surprise": "text that expresses surprise or shock",
        "disgust": "text that expresses disgust or revulsion",
        "excitement": "text that expresses excitement or enthusiasm",
        "neutral": "text that either expresses a neutral or indifferent emotion, or that does not express any emotion at all on account of being purely factual or descriptive."
    },
    num_samples=10000
)

Intended Uses

This model is intended to:

  • Classify the emotional tone of text inputs across multiple languages.
  • Be used in applications such as customer feedback analysis, social media monitoring, and sentiment analysis.
  • Serve as a lightweight alternative to larger models for emotion detection tasks.

Not intended for:

  • Highly specialized domains where emotions differ significantly from the predefined categories.
Downloads last month
172
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 tanaos/tanaos-emotion-detection-v1

Finetuned
(32)
this model

Dataset used to train tanaos/tanaos-emotion-detection-v1