ESGBERT/social_2k
Viewer • Updated • 2k • 44 • 1
How to use ESGBERT/SocRoBERTa-social with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="ESGBERT/SocRoBERTa-social") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("ESGBERT/SocRoBERTa-social")
model = AutoModelForSequenceClassification.from_pretrained("ESGBERT/SocRoBERTa-social")Based on this paper, this is the SocRoBERTa-social language model. A language model that is trained to better classify social texts in the ESG domain.
Note: We generally recommend choosing the SocialBERT-social model since it is quicker, less resource-intensive and only marginally worse in performance.
Using the SocRoBERTa-base model as a starting point, the SocRoBERTa-social Language Model is additionally fine-trained on a 2k social dataset to detect social text samples.
See these tutorials on Medium for a guide on model usage, large-scale analysis, and fine-tuning.
You can use the model with a pipeline for text classification:
from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
tokenizer_name = "ESGBERT/SocRoBERTa-social"
model_name = "ESGBERT/SocRoBERTa-social"
model = AutoModelForSequenceClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(tokenizer_name, max_len=512)
pipe = pipeline("text-classification", model=model, tokenizer=tokenizer) # set device=0 to use GPU
# See https://huggingface.co/docs/transformers/main_classes/pipelines#transformers.pipeline
print(pipe("We follow rigorous supplier checks to prevent slavery and ensure workers' rights.", padding=True, truncation=True))
@article{schimanski_ESGBERT_2024,
title = {Bridging the gap in ESG measurement: Using NLP to quantify environmental, social, and governance communication},
journal = {Finance Research Letters},
volume = {61},
pages = {104979},
year = {2024},
issn = {1544-6123},
doi = {https://doi.org/10.1016/j.frl.2024.104979},
url = {https://www.sciencedirect.com/science/article/pii/S1544612324000096},
author = {Tobias Schimanski and Andrin Reding and Nico Reding and Julia Bingler and Mathias Kraus and Markus Leippold},
}