Instructions to use NetworkIsLife/emotion-english-distilroberta-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NetworkIsLife/emotion-english-distilroberta-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="NetworkIsLife/emotion-english-distilroberta-base")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("NetworkIsLife/emotion-english-distilroberta-base") model = AutoModelForSequenceClassification.from_pretrained("NetworkIsLife/emotion-english-distilroberta-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Emotion English DistilRoBERTa-base (safetensors copy)
This repository is an unmodified copy of
j-hartmann/emotion-english-distilroberta-base
by Jochen Hartmann, with the weights stored in the safetensors format.
All credit for the model goes to the original author. Please cite the original (see below).
Why this copy exists
The original repository provides its PyTorch weights only as pytorch_model.bin, a Python pickle
archive that cannot be read outside Python. The R package
Rhobots, which runs transformer models natively in R through
torch, needs safetensors weights. This copy makes the model usable from R without Python.
model.safetensorsis thesafetensorsconversion made by Hugging Face's official conversion bot (pull requestrefs/pr/9on the original repository). All 106 weight tensors were checked to be bit-for-bit identical to the originalpytorch_model.binat commit0e1cd914e3d46199ed785853e12b57304e04178b.config.jsonand the tokenizer files (tokenizer.json,tokenizer_config.json,special_tokens_map.json,vocab.json,merges.txt) are copied unchanged from that commit.
Model
The model classifies English text into Ekman's six basic emotions plus a neutral class: anger, disgust, fear, joy, neutral, sadness, surprise.
It is a fine-tuned checkpoint of DistilRoBERTa-base, trained on a balanced subset (2,811 texts per emotion) of six datasets covering Twitter, Reddit, student self-reports and TV dialogue: Crowdflower (2016), Emotion Dataset (Elvis et al., 2018), GoEmotions (Demszky et al., 2020), ISEAR (Vikash, 2018), MELD (Poria et al., 2019) and SemEval-2018 EI-reg (Mohammad et al., 2018). The original author reports an evaluation accuracy of 66% (random baseline 14%). See the original model card for full details.
Usage
R (Rhobots)
library(Rhobots)
clf <- load_hf_classifier("NetworkIsLife/emotion-english-distilroberta-base")
classify_texts(clf, c("I am furious about this.", "The meeting is at 3pm."))
#> text label score anger disgust fear joy neutral sadness surprise
#> 1 I am furious about this. anger 0.99 0.986 0.0032 0.0024 0.00043 0.0051 0.002 0.0014
#> 2 The meeting is at 3pm. neutral 0.75 0.019 0.0151 0.0952 0.04529 0.7477 0.022 0.0562
Python (transformers)
from transformers import pipeline
classifier = pipeline("text-classification",
model="NetworkIsLife/emotion-english-distilroberta-base", top_k=None)
classifier("I love this!")
Licence
The original repository does not state a licence. This copy is provided only to make the model usable from R, with full attribution. If you are the author and would like this copy changed or removed, please open a discussion on this repository.
Reference
Please cite the original model:
Jochen Hartmann, "Emotion English DistilRoBERTa-base".
https://huggingface.co/j-hartmann/emotion-english-distilroberta-base/, 2022.
@misc{hartmann2022emotionenglish,
author = {Hartmann, Jochen},
title = {Emotion English DistilRoBERTa-base},
year = {2022},
howpublished = {\url{https://huggingface.co/j-hartmann/emotion-english-distilroberta-base/}},
}
- Downloads last month
- 25