đ BERT-base-uncased-hatexplain-rationale-two
This model is designed for text classification, specifically classifying text as Abusive (Hatespeech and Offensive) or Normal. It utilizes data from Gab and Twitter, and incorporates Human Rationales to enhance performance.
đ Quick Start
Details of usage
Please use the Model_Rational_Label class inside models.py to load the models. The default prediction in this hosted inference API may be wrong due to the use of different class initialisations.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from models import *
tokenizer = AutoTokenizer.from_pretrained("Hate-speech-CNERG/bert-base-uncased-hatexplain-rationale-two")
model = Model_Rational_Label.from_pretrained("Hate-speech-CNERG/bert-base-uncased-hatexplain-rationale-two")
inputs = tokenizer('He is a great guy", return_tensors="pt")
prediction_logits, _ = model(input_ids=inputs['input_ids'],attention_mask=inputs['attention_mask'])
⨠Features
- The model is used for classifying a text as Abusive (Hatespeech and Offensive) or Normal.
- It is trained using data from Gab and Twitter, and Human Rationales are included as part of the training data to boost the performance.
- The model also has a rationale predictor head that can predict the rationales given an abusive sentence.
đĻ Installation
No specific installation steps provided in the original document.
đģ Usage Examples
Basic Usage
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from models import *
tokenizer = AutoTokenizer.from_pretrained("Hate-speech-CNERG/bert-base-uncased-hatexplain-rationale-two")
model = Model_Rational_Label.from_pretrained("Hate-speech-CNERG/bert-base-uncased-hatexplain-rationale-two")
inputs = tokenizer('He is a great guy", return_tensors="pt")
prediction_logits, _ = model(input_ids=inputs['input_ids'],attention_mask=inputs['attention_mask'])
đ Documentation
Model Details
Uses
Direct Use
This model can be used for Text Classification.
Downstream Use
[More information needed]
Misuse and Out-of-scope Use
The model should not be used to intentionally create hostile or alienating environments for people. In addition, the model was not trained to be factual or true representations of people or events, and therefore using the model to generate such content is out-of-scope for the abilities of this model.
Risks, Limitations and Biases
â ī¸ Important Note
Readers should be aware this section contains content that is disturbing, offensive, and can propagate historical and current stereotypes.
Significant research has explored bias and fairness issues with language models (see, e.g., Sheng et al. (2021) and Bender et al. (2021)).
Predictions generated by the model can include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups. For example.
The model author's also note in their HateXplain paper that they
have not considered any external context such as profile bio, user gender, history of posts etc., which might be helpful in the classification task. Also, in this work we have focused on the English language. It does not consider multilingual hate speech into account.
Training
The authors detail their preprocessing procedure in the Github repository.
Evaluation
The mode authors detail the Hidden layer size and attention for the HateXplain fien tuned models in the associated paper.
Results
The model authors both in their paper and in the git repository provide the illustrative output of the BERT - HateXplain in comparison to BERT and and other HateXplain fine tuned models.
Citation Information
@article{mathew2020hatexplain,
title={HateXplain: A Benchmark Dataset for Explainable Hate Speech Detection},
author={Mathew, Binny and Saha, Punyajoy and Yimam, Seid Muhie and Biemann, Chris and Goyal, Pawan and Mukherjee, Animesh},
journal={arXiv preprint arXiv:2012.10289},
year={2020}
}
đ License
This project is licensed under the Apache-2.0 license.