readme: ---
  language: en
  license: apache-2.0
  datasets:
    - hatexplain
  ---
  
  
  ## Table of Contents
  - [Model Details](#model-details)
  - [How to Get Started With the Model](#how-to-get-started-with-the-model)
  - [Uses](#uses)
  - [Risks, Limitations and Biases](#risks-limitations-and-biases)
  - [Training](#training)
  - [Evaluation](#evaluation)
  - [Technical Specifications](#technical-specifications)
  - [Citation Information](#citation-information)
  
  ## Model Details
  **Model Description:** 
  The model is used for classifying a text as Abusive (Hatespeech and Offensive) or Normal. The model is trained using data from Gab and Twitter and Human Rationales were 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
  
  
  - **Developed by:** Binny Mathew, Punyajoy Saha, Seid Muhie Yimam, Chris Biemann, Pawan Goyal, and Animesh Mukherjee 
  - **Model Type:** Text Classification
  - **Language(s):**  English
  - **License:**  Apache-2.0
  - **Parent Model:** See the [BERT base uncased model](https://huggingface.co/bert-base-uncased) for more information about the BERT base model.
  - **Resources for more information:**
    - [Research Paper](https://arxiv.org/abs/2012.10289) Accepted at AAAI 2021.
    - [GitHub Repo with datatsets and models](https://github.com/punyajoy/HateXplain)
  
  
                                                                                                 
  ## How to Get Started with the Model
  
  **Details of usage**
  
  Please use the **Model_Rational_Label** class inside [models.py](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.
  
  ```python
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
  ### from models.py
  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'])
  ```
  
  ## 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
  
  **CONTENT WARNING: 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)](https://aclanthology.org/2021.acl-long.330.pdf) and [Bender et al. (2021)](https://dl.acm.org/doi/pdf/10.1145/3442188.3445922)).
  
  (and if you can generate an example of a biased prediction, also something like this): 
  
  Predictions generated by the model can include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups. For ![example:](https://github.com/hate-alert/HateXplain/blob/master/Figures/dataset_example.png) 
  
  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 Procedure
  
  ##### Preprocessing
  
  The authors detail their preprocessing procedure in the [Github repository](https://github.com/hate-alert/HateXplain/tree/master/Preprocess)
  
  
  ## Evaluation
  The mode authors detail the Hidden layer size and attention for the HateXplain fien tuned models in the [associated paper](https://arxiv.org/pdf/2012.10289.pdf)
  
  #### 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]( https://github.com/hate-alert/HateXplain/blob/master/Figures/bias-subgroup.pdf)
  
  ## Citation Information
  
  ```bibtex
  @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}
  
  }
  ```
  
  
  
  
  