Downloads · 30 days
13
31% of all-time downloads
adityakp15/hw1-hc3-detector
hw1-hc3-detector is a machine learning model from adityakp15. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This repository contains a fine-tuned transformer classifier for distinguishing human-written text from ChatGPT-generated text in the HC3 dataset.
Downloads · 30 days
13
31% of all-time downloads
All-time downloads
42
Public
Parameters
22.7M
182 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors90.9 MB · 99%
From the Hugging Face model README
This repository contains a fine-tuned transformer classifier for distinguishing human-written text from ChatGPT-generated text in the HC3 dataset.
| Model | Test accuracy |
|---|---|
| Frozen sentence-transformer baseline | 0.8449 |
| Fine-tuned classifier | 0.9837 |
The fine-tuned model was trained for five epochs with AdamW and a learning
rate of 2e-5. The test split was held out during training. Results may vary
slightly with hardware or library versions.
The model was trained and evaluated on the HC3 dataset, using its human and ChatGPT answer labels. Splits were kept disjoint by question ID to reduce question overlap between training, validation, and test data.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
repo_id = "adityakp15/hw1-hc3-detector"
tokenizer = AutoTokenizer.from_pretrained(repo_id)
model = AutoModelForSequenceClassification.from_pretrained(repo_id)
text = "Text to classify"
inputs = tokenizer(text, return_tensors="pt", truncation=True)
with torch.no_grad():
prediction = model(**inputs).logits.argmax(dim=-1).item()
label = model.config.id2label.get(prediction, str(prediction))
print(label)
The classifier labels are 0 for human-written text and 1 for ChatGPT-
generated text.
2e-553242