Downloads · 30 days
12
6% of all-time downloads
keanteng/bert-base-generalized-climate-sentiment-wqf7007
bert-base-generalized-climate-sentiment-wqf7007 is a text classification model from keanteng. Use it when you need a label for a piece of text. The card lists the license as agpl-3.0.
This model fine-tunes BERT (bert-base-uncased) to perform sentiment analysis on climate change-related tweets. It classifies tweets into four sentiment categories: anti-climate (negative), neutral, pro-climate (positi…
Downloads · 30 days
12
6% of all-time downloads
All-time downloads
199
Public
Parameters
109M
438 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors438 MB · 100%
From the Hugging Face model README
This model fine-tunes BERT (bert-base-uncased) to perform sentiment analysis on climate change-related tweets. It classifies tweets into four sentiment categories: anti-climate (negative), neutral, pro-climate (positive), and news.
This model was trained on the Twitter Climate Change Sentiment Dataset, which contains tweets related to climate change labeled with sentiment categories:
The dataset was cleaned with the following steps:
| Features | Strategy |
|---|---|
| Hashtag | Kept |
| Mention | Generalized |
| RT Tag | Generalized |
| URL | Generalized |
| Stop Words | Kept |
| Special Characters | Removed |


from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("google/bert-base-uncased")
model = AutoModelForSequenceClassification.from_pretrained("keanteng/bert-base-generalized-climate-sentiment-wqf7007")
# Prepare text
text = "Climate change is real and we need to act now!"
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
# Make prediction
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.argmax(outputs.logits, dim=1)
# Map prediction to sentiment
sentiment_map = {-1: "anti", 0: "neutral", 1: "pro", 2: "news"}
predicted_sentiment = sentiment_map[predictions.item()]
print("Predicted sentiment: " + predicted_sentiment)
This model should be used responsibly for analyzing climate sentiment and should not be deployed in ways that might: