This project is designed to classify text as either AI-generated or human-written using a fine-tuned BERT model. The entire process includes data preprocessing, training, evaluation, and prediction.
๐ Project Setup
1. Mount Google Drive (Colab Users)
If using Google Colab, first mount your Google Drive:
๐ฆ Install Dependencies
Ensure the required libraries are installed:
๐ Dataset Preparation
2. Update Dataset Paths
Modify the paths to match your Google Drive structure:
3. Load Datasets
4. Preprocess Data
Ensure correct column names
Assign labels: 0 for Human, 1 for AI
Merge and shuffle the dataset
๐ Tokenization & Dataset Creation
5. Load BERT Tokenizer
6. Convert Data into Tensor Format
7. Create DataLoaders
๐๏ธ Model Setup
8. Load or Initialize Model
9. Define Optimizer
๐ฏ Training & Evaluation
10. Train the Model
11. Evaluate the Model
12. Train & Evaluate
๐ง Text Prediction
13. Define Prediction Function
14. User Input for Testing
๐ฏ Final Notes
Ensure dataset paths are correct.
Model saves automatically after training.
Run the script in Google Colab or a local Python environment.
##๐นScreenshots
โ Now you are ready to classify AI vs Human text!