CoolFace
Modelpublic

descartes100/distilBERT_ESG

sourceHugging Faceapache-2.0updated 3y agoView on Hugging Face
4likes31downloads
Model Card

Model description

This repository contains a fine-tuned DistilBERT model using the esg-sentiment dataset. DistilBERT, a distilled version of BERT, is a powerful transformer-based model for natural language processing tasks. The model has been fine-tuned on the ESG (Environmental, Social, and Governance) sentiment dataset, allowing it to capture nuanced sentiments related to sustainability and corporate responsibility.

Features

  • —DistilBERT-based architecture
  • —Fine-tuned on the esg-sentiment dataset
  • —Optimized for sentiment analysis in the context of ESG

Usage

from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
import torch

tokenizer = DistilBertTokenizer.from_pretrained('descartes100/distilBERT_ESG')
model = DistilBertForSequenceClassification.from_pretrained('descartes100/distilBERT_ESG')

text = "Our waste reduction initiatives aim to minimize environmental impact. From recycling programs to waste reduction technologies, we're dedicated to responsibly managing resources."
encoding = tokenizer(text, return_tensors="pt")
encoding = {k: v.to(trainer.model.device) for k,v in encoding.items()}
outputs = model(**encoding)
logits = outputs.logits
sigmoid = torch.nn.Sigmoid()
probs = sigmoid(logits.squeeze().cpu())
predictions = np.zeros(probs.shape)
predictions[np.where(probs >= 0.5)] = 1

for idx, label in enumerate(predictions):
  print(id2label[idx], ':', label)

Result

Environmental Negative : 0.0
Environmental Neutral : 0.0
Environmental Positive : 1.0
Social Negative : 0.0
Social Neutral : 0.0
Social Positive : 1.0
Governance Negative : 0.0
Governance Neutral : 0.0
Governance Positive : 0.0

Intended uses & limitations

Intended Uses

The fine-tuned DistilBERT model is designed for sentiment analysis tasks related to ESG considerations. It can be used to analyze and classify text data, providing insights into the sentiment towards environmental, social, and governance practices.

Limitations

  • —The model's performance is directly influenced by the quality and diversity of the training data.
  • —It may not generalize well to domains outside the ESG context.
  • —Users are encouraged to validate results on their specific use cases and datasets.

Training procedure

Training hyperparameters

The following hyperparameters were used during training:

  • —learning_rate: 2e-05
  • —trainbatchsize: 8
  • —evalbatchsize: 8
  • —seed: 42
  • —optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • —lrschedulertype: linear
  • —num_epochs: 5

Training results

Training LossEpochStepValidation LossF1Roc AucAccuracy
No log1.0770.37310.40.63220.2647
No log2.01540.31580.23420.56510.1324
No log3.02310.27730.50.67910.3382
No log4.03080.26360.60490.74420.3382
No log5.03850.25910.62960.75690.3824

Framework versions

  • —Transformers 4.35.2
  • —Pytorch 2.1.0+cu118
  • —Datasets 2.15.0
  • —Tokenizers 0.15.0