Downloads · 30 days
15
3% of all-time downloads
aisingapore/RoBERTa-base
RoBERTa-base is a text classification model from aisingapore. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as mit.
You can test the model at Emotion Entailment | SGNLP-Demo.<br / If you want to find out more information, please contact us at [email protected].
Downloads · 30 days
15
3% of all-time downloads
All-time downloads
563
Public
Repo size
1 GB
Likes
0
Public
Click a slice to open those files.
.bin501 MB · 100%
From the Hugging Face model README
You can test the model at Emotion Entailment | SGNLP-Demo.<br /> If you want to find out more information, please contact us at [email protected].
Model Name: Emotion Entailment
SGnlp is an initiative by AI Singapore's NLP Hub. They aim to bridge the gap between research and industry, promote translational research, and encourage adoption of NLP techniques in the industry. <br><br> Various NLP models, other than aspect sentiment analysis are available in the python package. You can try them out at SGNLP-Demo | SGNLP-Github.
pip install sgnlp
For more full code (such as Emotion Entailment), please refer to this SGNLP-Docs. <br> Alternatively, you can also try out the Emotion Entailment | SGNLP-Demo for Emotion Entailment.
Example of Emotion Entailment (for happiness):
from sgnlp.models.emotion_entailment import (
RecconEmotionEntailmentConfig,
RecconEmotionEntailmentTokenizer,
RecconEmotionEntailmentModel,
RecconEmotionEntailmentPreprocessor,
RecconEmotionEntailmentPostprocessor,
)
# Load model
config = RecconEmotionEntailmentConfig.from_pretrained(
"https://storage.googleapis.com/sgnlp-models/models/reccon_emotion_entailment/config.json"
)
tokenizer = RecconEmotionEntailmentTokenizer.from_pretrained("roberta-base")
model = RecconEmotionEntailmentModel.from_pretrained(
"https://storage.googleapis.com/sgnlp-models/models/reccon_emotion_entailment/pytorch_model.bin",
config=config,
)
preprocessor = RecconEmotionEntailmentPreprocessor(tokenizer)
postprocessor = RecconEmotionEntailmentPostprocessor()
# Model predict
input_batch = {
"emotion": ["happiness", "happiness", "happiness", "happiness"],
"target_utterance": [
"Thank you very much .",
"Thank you very much .",
"Thank you very much .",
"Thank you very much .",
],
"evidence_utterance": [
"It's very thoughtful of you to invite me to your wedding .",
"How can I forget my old friend ?",
"My best wishes to you and the bride !",
"Thank you very much .",
],
"conversation_history": [
"It's very thoughtful of you to invite me to your wedding . How can I forget my old friend ? My best wishes to you and the bride ! Thank you very much .",
"It's very thoughtful of you to invite me to your wedding . How can I forget my old friend ? My best wishes to you and the bride ! Thank you very much .",
"It's very thoughtful of you to invite me to your wedding . How can I forget my old friend ? My best wishes to you and the bride ! Thank you very much .",
"It's very thoughtful of you to invite me to your wedding . How can I forget my old friend ? My best wishes to you and the bride ! Thank you very much .",
],
}
tensor_dict = preprocessor(input_batch)
raw_output = model(**tensor_dict)
output = postprocessor(raw_output)
The train and evaluation datasets were derived from the RECCON dataset. The full dataset can be downloaded from the author's github repository.