Views
No views yet
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4tokenizer = AutoTokenizer.from_pretrained("GeorgeDrayson/modernbert-raid-mage")
5model = AutoModelForSequenceClassification.from_pretrained("GeorgeDrayson/modernbert-raid-mage")
6
7text = "Your input text here."
8inputs = tokenizer(text, return_tensors="pt")
9outputs = model(**inputs)
10probabilities = torch.nn.functional.softmax(outputs.logits, dim=-1)
11print(f"Probability of machine-generated text: {probabilities[0][1].item():.4f}")1@article{drayson2025machine,
2 title={Machine-generated text detection prevents language model collapse},
3 author={Drayson, George and Yilmaz, Emine and Lampos, Vasileios},
4 journal={arXiv preprint arXiv:2502.15654},
5 year={2025}
6}