Text Classification
Transformers
Safetensors
PyTorch
English
bert
multi-label-classification
toxicity-detection
Eval Results (legacy)
text-embeddings-inference
Run this model with HF Jobs
Run Koushim/bert-multilabel-jigsaw-toxic-classifier on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Koushim/bert-multilabel-jigsaw-toxic-classifier. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Koushim/bert-multilabel-jigsaw-toxic-classifier on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Koushim/bert-multilabel-jigsaw-toxic-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Koushim/bert-multilabel-jigsaw-toxic-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Koushim/bert-multilabel-jigsaw-toxic-classifier")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, CustomBertForMultiLabel tokenizer = AutoTokenizer.from_pretrained("Koushim/bert-multilabel-jigsaw-toxic-classifier") model = CustomBertForMultiLabel.from_pretrained("Koushim/bert-multilabel-jigsaw-toxic-classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465---library_name: transformerstags:- generated_from_trainermetrics:- accuracy- f1- precision- recallmodel-index:- name: bert-multilabel-jigsaw-toxic-classifierresults: []---<!-- This model card has been generated automatically according to the information the Trainer had access to. Youshould probably proofread and complete it, then remove this comment. --># bert-multilabel-jigsaw-toxic-classifierThis model is a fine-tuned version of [](https://huggingface.co/) on an unknown dataset.It achieves the following results on the evaluation set:- Loss: 1.6768- Accuracy: 0.9187- F1: 0.0- Precision: 0.0- Recall: 0.0## Model descriptionMore information needed## Intended uses & limitationsMore information needed## Training and evaluation dataMore information needed## Training procedure### Training hyperparametersThe following hyperparameters were used during training:- learning_rate: 5e-05- train_batch_size: 16- eval_batch_size: 64- seed: 42- optimizer: Use OptimizerNames.ADAMW_TORCH with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments- lr_scheduler_type: linear- num_epochs: 1### Training results| Training Loss | Epoch | Step | Validation Loss | Accuracy | F1 | Precision | Recall ||:-------------:|:-----:|:------:|:---------------:|:--------:|:---:|:---------:|:------:|| 1.3585 | 1.0 | 112805 | 1.6768 | 0.9187 | 0.0 | 0.0 | 0.0 |### Framework versions- Transformers 4.51.3- Pytorch 2.6.0+cu124- Datasets 3.6.0- Tokenizers 0.21.1123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116---language: endatasets:- jigsaw-toxic-comment-classification-challengetags:- text-classification- multi-label-classification- toxicity-detection- bert- transformers- pytorchlicense: apache-2.0model-index:- name: BERT Multi-label Toxic Comment Classifierresults:- task:name: Multi-label Text Classificationtype: multi-label-classificationdataset:name: Jigsaw Toxic Comment Classification Challengetype: jigsaw-toxic-comment-classification-challengemetrics:- name: Accuracytype: accuracyvalue: 0.9187 # Replace with your actual score---# BERT Multi-label Toxic Comment ClassifierThis model is a fine-tuned [`bert-base-uncased`](https://huggingface.co/bert-base-uncased) transformer for **multi-label classification** on the [Jigsaw Toxic Comment Classification Challenge](https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge) dataset.It predicts multiple toxicity-related labels per comment, including:- toxicity- severe toxicity- obscene- threat- insult- identity attack- sexual explicit## Model Details- **Base Model**: `bert-base-uncased`- **Task**: Multi-label text classification- **Dataset**: Jigsaw Toxic Comment Classification Challenge (processed version)- **Labels**: 7 toxicity-related categories- **Training Epochs**: 2- **Batch Size**: 16 (train), 64 (eval)- **Metrics**: Accuracy, Macro F1, Precision, Recall## Usage```pythonfrom transformers import AutoTokenizer, AutoModelForSequenceClassificationtokenizer = AutoTokenizer.from_pretrained("Koushim/bert-multilabel-jigsaw-toxic-classifier")model = AutoModelForSequenceClassification.from_pretrained("Koushim/bert-multilabel-jigsaw-toxic-classifier")text = "You are a wonderful person!"inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=128)outputs = model(**inputs)# Sigmoid to get probabilities for each labelimport torchprobs = torch.sigmoid(outputs.logits)print(probs)````## Labels| Index | Label || ----- | ---------------- || 0 | toxicity || 1 | severe_toxicity || 2 | obscene || 3 | threat || 4 | insult || 5 | identity_attack || 6 | sexual_explicit |## Training Details* Training Set: Full dataset (160k+ samples)* Loss Function: Binary Cross Entropy (via `BertForSequenceClassification` with `problem_type="multi_label_classification"`)* Optimizer: AdamW* Learning Rate: 2e-5* Evaluation Strategy: Epoch-based evaluation with early stopping on F1 score* Model Framework: PyTorch with Hugging Face Transformers## Repository Contents* `pytorch_model.bin` - trained model weights* `config.json` - model configuration* `tokenizer.json`, `vocab.txt` - tokenizer files* `README.md` - this file## How to Fine-tune or TrainYou can fine-tune this model using the Hugging Face `Trainer` API with your own dataset or the original Jigsaw dataset.## CitationIf you use this model in your research or project, please cite:```@article{devlin2019bert,title={BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding},author={Devlin, Jacob and Chang, Ming-Wei and Lee, Kenton and Toutanova, Kristina},journal={arXiv preprint arXiv:1810.04805},year={2019}}```## LicenseApache 2.0 License
README.md+95-44