Views
No views yet
answerdotai/ModernBERT-large, trained on a balanced
HC3 split.checkpoint-50, checkpoint-100,
checkpoint-150, checkpoint-200, checkpoint-225);src/;answerdotai/ModernBERT-large.human=0, ai=1.Wqkv, Wo, Wi, dense.r=16.32.0.05.Hello-SimpleAI/HC3human, ai2e-5| Metric | Value |
|---|---|
| Accuracy | 0.9695 |
| Precision | 0.9440 |
| Recall | 0.9969 |
| F1 | 0.9697 |
| AUROC | 0.9975 |
| Average precision | 0.9962 |
| Checkpoint | Epoch | Eval loss |
|---|---|---|
| checkpoint-50 | 0.67 | 0.3219 |
| checkpoint-100 | 1.34 | 0.0853 |
| checkpoint-150 | 2.00 | 0.0537 |
| checkpoint-200 | 2.67 | 0.0454 |
| checkpoint-225 | 3.00 | best model loaded from step 200 |
eval_loss=0.045422744.1import torch
2from transformers import AutoModelForSequenceClassification, AutoTokenizer
3from peft import PeftModel
4
5repo_id = "simonlesaumon/open-pangram-modernbert-hc3-detector"
6base_id = "answerdotai/ModernBERT-large"
7
8tokenizer = AutoTokenizer.from_pretrained(repo_id)
9base_model = AutoModelForSequenceClassification.from_pretrained(
10 base_id,
11 num_labels=2,
12 torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
13)
14model = PeftModel.from_pretrained(base_model, repo_id)
15model.eval()
16if torch.cuda.is_available():
17 model.cuda()
18
19text = "As an AI language model, I can provide a concise explanation."
20encoded = tokenizer(
21 [text],
22 truncation=True,
23 max_length=64,
24 padding="max_length",
25 return_tensors="pt",
26)
27if torch.cuda.is_available():
28 encoded = encoded.to("cuda")
29
30with torch.no_grad():
31 probability_ai = torch.softmax(model(**encoded).logits, dim=-1)[0, 1].item()
32
33print(probability_ai)src/inference.py.1pip install torch transformers peft gradio numpy
2python src/app.py64) because that was the stable training path
in this environment; long documents are scored by window aggregation.