Twitter RoBERTa Sentiment Node
This node applies the twitter-roberta-base-sentiment-latest model from Hugging Face (CardiffNLP) to perform sentiment analysis on text data. The model is a RoBERTa-base transformer trained on Twitter data, designed to classify text into positive, neutral, or negative sentiment.
The node accepts two parameters:
Path to the Model: Absolute path to the directory containing the pre-downloaded Hugging Face model (for example: /Users/username/models/twitter-roberta-base-sentiment-latest).
Column From: The name of the column containing the text to be analyzed.
For each row of input text, the node produces three output columns:
positive_mean – mean confidence score across chunks classified as positive.
neutral_mean – mean confidence score across chunks classified as neutral.
negative_mean – mean confidence score across chunks classified as negative.
Additionally, a sentiment_status column is returned to indicate "ok" if processing succeeded, or the error message if it failed.
Requirements
You must have a Python environment with the following packages installed:
pip install torch torchvision torchaudio
pip install transformers
On macOS with Apple Silicon (M1/M2/M3), the node uses Metal (MPS) acceleration if available; on other systems it prefers CUDA (NVIDIA GPUs), else CPU.