Downloads · 30 days
58
1% of all-time downloads
MonkeyDAnh/my-awesome-ai-detector-roberta-base-v4-human-vs-machine-finetune
my-awesome-ai-detector-roberta-base-v4-human-vs-machine-finetune is a text classification model from MonkeyDAnh. Use it when you need a label for a piece of text. The card lists the license as mit.
This model is a fine-tuned version of FacebookAI/roberta-base designed to detect whether a given text is generated by AI or written by a human. It has been sequentially fine-tuned distinct datasets to enhance its robu…
Downloads · 30 days
58
1% of all-time downloads
All-time downloads
4.2K
Public
Parameters
125M
1.5 GB on disk
Likes
3
Public
Click a slice to open those files.
.safetensors499 MB · 99%
From the Hugging Face model README
This model is a fine-tuned version of FacebookAI/roberta-base designed to detect whether a given text is generated by AI or written by a human. It has been sequentially fine-tuned distinct datasets to enhance its robustness and generalization capabilities across various text domains. The model aims to achieve high accuracy in distinguishing between human-produced and machine-generated content, making it a valuable tool for applications requiring AI text detection.
Intended Use: The model is intended for research and practical applications involving the detection of AI-generated text. It can be used as a component in systems for content moderation, academic integrity checks, or general content analysis.
Limitations and Bias:
The model was sequentially fine-tuned on the following datasets:
artem9k/ai-text-detection-pile:
train-00000-of-00007-bc5952562e004d67.parquet and 10,000 rows from train-00006-of-00007-3d8a471ba0cf1c8d.parquet. This dataset contains a variety of text samples labeled as AI-generated or human-written.Ateeqq/AI-and-Human-Generated-Text:
NicolaiSivesind/human-vs-machine:
wiki-labeled.csv and research-abstracts-labeled.csv. This further enhances the model's ability to distinguish between human-produced and machine-generated content, particularly focusing on Wikipedia articles and research abstracts.The model started with weights from FacebookAI/roberta-base.
The model was fine-tuned sequentially, meaning the output of one fine-tuning stage served as the starting point for the next.
The following hyperparameters were used during each fine-tuning phase:
All training was performed on a Google Colab GPU T4.
artem9k/ai-text-detection-pile: 1 hour 12 minutes 14 secondsAteeqq/AI-and-Human-Generated-Text: 0 hours 30 minutes 36 secondsNicolaiSivesind/human-vs-machine: 1 hour 04 minutes 22 secondsOverall Total Training Time: Approximately 2 hours 47 minutes 12 seconds across all fine-tuning stages.
The model's performance was evaluated on the validation splits of each respective dataset during its fine-tuning phase. The overall metrics reflect the performance of the final model after all sequential fine-tuning stages.
To use the model for inference, you can load it with the Hugging Face Transformers library:
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
# Define the model name/path
model_name = "MonkeyDAnh/my-awesome-ai-detector-roberta-base"
# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Move model to GPU if available
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
# Define label mapping (ensure this matches your model's config.id2label if available)
# Based on your ClassLabel definition (0: human-produced, 1: machine-generated)
id_to_label = model.config.id2label if hasattr(model.config, 'id2label') else {0: "human-produced", 1: "machine-generated"}
# Example text for inference
text = "This is a sample text to detect AI generation. It is written to sound very robotic and unnatural."
# Tokenize the input text
# Using max_length=512 for standard RoBERTa, adjust if your MAX_LENGTH_CHUNK was different
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=512).to(device)
# Perform inference
outputs = model(**inputs)
# Get predicted label ID and convert to integer
predictions_id = outputs.logits.argmax(-1).item()
# Map ID to the human-readable label
predicted_label = id_to_label[predictions_id]
print(f"Text: \"{text}\"")
print(f"Predicted Label ID: {predictions_id}")
print(f"Predicted Label: {predicted_label}")
# Expected output examples:
# Predicted Label: human-produced
# Predicted Label: machine-generated