Views
No views yet
1from transformers import AutoModelForSequenceClassification, AutoTokenizer, TextClassificationPipeline
2
3model_path = "martin-ha/toxic-comment-model"
4tokenizer = AutoTokenizer.from_pretrained(model_path)
5model = AutoModelForSequenceClassification.from_pretrained(model_path)
6
7pipeline = TextClassificationPipeline(model=model, tokenizer=tokenizer)
8print(pipeline('This is a test text.'))| subgroup | subgroup_size | subgroup_auc | bpsn_auc | bnsp_auc |
|---|---|---|---|---|
| muslim | 108 | 0.689 | 0.811 | 0.88 |
| jewish | 40 | 0.749 | 0.86 | 0.825 |
| homosexual_gay_or_lesbian | 56 | 0.795 | 0.706 | 0.972 |
| black | 84 | 0.866 | 0.758 | 0.975 |
| white | 112 | 0.876 | 0.784 | 0.97 |
| female | 306 | 0.898 | 0.887 | 0.948 |
| christian | 231 | 0.904 | 0.917 | 0.93 |
| male | 225 | 0.922 | 0.862 | 0.967 |
| psychiatric_or_mental_illness | 26 | 0.924 | 0.907 | 0.95 |
train.csv data to train the model.