Fine-Tuned DistilBERT Text Classification Model

Model Description

This repository contains a fine-tuned DistilBERT model for binary text classification.

The model was fine-tuned using a labeled text dataset and can be used to classify new text into one of two classes.

The model was developed using the Hugging Face Transformers library and PyTorch.


Model Details

  • Model architecture: DistilBERT
  • Task: Binary Text Classification
  • Framework: PyTorch
  • Library: Hugging Face Transformers
  • Model format: Safetensors
  • Number of parameters: Approximately 67 million
  • Maximum sequence length: Depends on the preprocessing configuration
  • Output: Two classification classes

Intended Use

This model is intended for:

  • Text classification experiments
  • Academic and research purposes
  • Demonstration of Transformer fine-tuning
  • Natural Language Processing (NLP) experiments
  • Classification of text into two predefined categories

The model should be used only within the context of the dataset and task on which it was trained.


Not Intended For

This model should not be used:

  • As a replacement for professional judgment
  • For high-stakes automated decisions without human review
  • Outside the domain represented by the training data without additional validation
  • As a general-purpose language model
  • As evidence that the model will perform equally well on unseen populations or different datasets

Training

Base Model

The model is based on the DistilBERT Transformer architecture.

DistilBERT is a smaller and faster version of BERT designed to retain much of BERT's language understanding capability while reducing computational requirements.

The pretrained model was further trained (fine-tuned) on a labeled text classification dataset.


Fine-Tuning Process

The general workflow used for this project was:

  1. Load the text dataset.
  2. Prepare the text and labels.
  3. Split the data into training, validation, and test sets.
  4. Tokenize the text using the DistilBERT tokenizer.
  5. Load a pretrained DistilBERT model for sequence classification.
  6. Fine-tune the model using the training dataset.
  7. Evaluate the model using the validation dataset during the training process.
  8. Evaluate the final model on the held-out test dataset.
  9. Calculate classification metrics.
  10. Generate a confusion matrix.
  11. Save the trained model and tokenizer.
  12. Upload the fine-tuned model to Hugging Face.
  13. Load the uploaded model again from Hugging Face.
  14. Test the loaded model on new text.

Dataset

The model was trained using a labeled text classification dataset.

The dataset contains:

  • A text input
  • A corresponding binary class label

The exact dataset source and dataset-specific description should be added here if required by the project.

Dataset Split

The data was divided into:

  • Training set
  • Validation set
  • Test set

The final test set contained:

200 samples

with the following class distribution:

Class Number of Samples
Class 0 100
Class 1 100
Total 200

The test set was therefore balanced between the two classes.


Labels

The model performs binary classification.

The output classes are:

Label Meaning
0 Class 0
1 Class 1

Note: Replace "Class 0" and "Class 1" with the actual meaning of your labels if your project defines them differently.

For example, if your dataset defines:

0 = Negative
1 = Positive
Downloads last month
21
Safetensors
Model size
67M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support