Downloads · 30 days
3
8% of all-time downloads
newreyy/spam-detection-distilbert-v1
spam-detection-distilbert-v1 is a machine learning model from newreyy. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Architecture: Based on cahya/distilbert-base-indonesian Task: Binary text classification — Spam vs Non-Spam Language: Indonesian Data Sources: Mixed datasets from Indonesian social platforms Performance: 98,21% accura…
Downloads · 30 days
3
8% of all-time downloads
All-time downloads
37
Public
Parameters
68.1M
272 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors272 MB · 100%
From the Hugging Face model README
cahya/distilbert-base-indonesianfrom transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
tokenizer = AutoTokenizer.from_pretrained("newreyy/spam-detection-distilbert-v1")
model = AutoModelForSequenceClassification.from_pretrained("newreyy/spam-detection-distilbert-v1")
text = "Selamat! Anda memenangkan hadiah ratusan juta rupiah!"
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
with torch.no_grad():
logits = model(**inputs).logits
probs = torch.softmax(logits, dim=1).squeeze()
predicted_label = torch.argmax(probs).item()
result = "Spam" if predicted_label == 1 else "Not Spam"
confidence = probs[predicted_label].item()
print(f"Input Text: {text}")
print(f"Prediction: {result} (Confidence: {confidence:.2%})")
Input: Single string of Indonesian text (up to 512 tokens)
Output:
0 = Not Spam1 = Spam| Metric | Score |
|---|---|
| Accuracy | 98% |
| Precision | 98% |
| Recall | 98% |
| F1-Score | 98% |
Sample classification report:
precision recall f1-score support
Not Spam 1.00 0.96 0.98 609
Spam 0.97 1.00 0.98 674
Overall 0.98 0.98 0.98 1283
Data was preprocessed to remove empty lines, invalid entries, and normalized using standard NLP techniques.
| Parameter | Value |
|---|---|
| Pre-trained Model | DistilBERT Base Indonesian |
| Epochs | 3 |
| Batch Size | 16 |
| Learning Rate | 2e-5 |
| Optimizer | AdamW |
| Loss Function | CrossEntropyLoss |
| Max Sequence Length | 512 tokens |
This model is distributed under the MIT License, free to use for both academic and commercial projects.
If you use this model in your work, please cite it as follows:
@misc{newreyy_distilbert_base_indonesian,
title={Indonesian Spam Detection DistilBERT v1},
author={NewReyy},
year={2025},
howpublished={\url{https://huggingface.co/newreyy/spam-detection-distilbert-v1/}}
}
And also consider citing the original base model:
@misc{cahya_distilbert_base_indonesian,
title={DistilBERT Base Indonesian},
author={Cahya},
year={2021},
howpublished={\url{https://huggingface.co/cahya/distilbert-base-indonesian}}
}
Special thanks to:
cahya for the BERT base model.