li2017dailydialog/daily_dialog
Updated • 11.7k • 157
This is the repo for Gen AI final project
This is a Transformer-based model designed for emotion classification and dialogue act recognition on the DailyDialog dataset. It processes multi-turn dialogues to predict emotional states and communication intentions. A Stacked Autoencoder (SAE) is included to regularize node usage, encouraging sparsity in feature representations.
While the model successfully predicts dialogue acts, it faces challenges in emotion classification, often outputting binary labels (0 or 1) due to imbalanced data or other limitations.
The model is trained and evaluated on the DailyDialog dataset.
input_ids and attention_mask.If you use this model or the DailyDialog dataset, please cite:
@inproceedings{li2017dailydialog,
title={DailyDialog: A Manually Labelled Multi-turn Dialogue Dataset},
author={Li, Yanran and others},
booktitle={Proceedings of the International Joint Conference on Artificial Intelligence (IJCAI)},
year={2017}
}
## Info
License: Mit
Original code: https://github.com/hyunwoongko/transformer
My version: https://github.com/Agaresd47/transformer_SAE
Data: Source: https://huggingface.co/datasets/li2017dailydialog/daily_dialog
## Usage
```python
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch.nn.functional as F
# Load the model and tokenizer
model = AutoModelForSequenceClassification.from_pretrained("agaresd/your-model-name")
tokenizer = AutoTokenizer.from_pretrained("agaresd/your-model-name")
# Define the label mapping
label_mapping = {
0: "no emotion",
1: "anger ",
2: "disgust ",
3: "fear ",
4: "Emotion: Happy",
5: "Emotion: Sad",
6: "Emotion: surprise"
}
# Input text
input_text = "happy"
# Tokenize and get model outputs
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model(**inputs)
# Get logits, apply softmax, and find the predicted class
logits = outputs.logits
probabilities = F.softmax(logits, dim=-1)
predicted_class = torch.argmax(probabilities, dim=-1).item()
# Map the predicted class to a word
predicted_label = label_mapping[predicted_class]
print(f"Input: {input_text}")
print(f"Predicted Label: {predicted_label}")