Views
No views yet
| Property | Value |
|---|---|
| Base Model | xlm-roberta-base |
| Language | Uzbek (Latin & Cyrillic scripts) |
| Task | Binary Text Classification |
| Labels | spam, normal |
1from transformers import pipeline
2
3# Load the model
4classifier = pipeline("text-classification", model="sukhrobnurali/uzbek-spam-detector")
5
6# Classify messages
7result = classifier("Salom! Bugun uchrashuvga kela olasanmi?")
8print(result)
9# [{'label': 'normal', 'score': 0.98}]
10
11result = classifier("TEZKOR KREDIT! 50% chegirma! Bosing: example.com")
12print(result)
13# [{'label': 'spam', 'score': 0.99}]1messages = [
2 "Rahmat katta yordam uchun!",
3 "Tabriklaymiz! Siz 1000$ yutdingiz!",
4 "Kecha juda charchab uyga keldim",
5]
6
7results = classifier(messages)
8for msg, res in zip(messages, results):
9 print(f"{res['label']}: {msg[:40]}...")1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4tokenizer = AutoTokenizer.from_pretrained("sukhrobnurali/uzbek-spam-detector")
5model = AutoModelForSequenceClassification.from_pretrained("sukhrobnurali/uzbek-spam-detector")
6
7text = "Bizning kanalga obuna bo'ling!"
8inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
9
10with torch.no_grad():
11 outputs = model(**inputs)
12 prediction = torch.argmax(outputs.logits, dim=-1)
13
14label = model.config.id2label[prediction.item()]
15print(f"Prediction: {label}")| Split | Samples | Spam | Normal |
|---|---|---|---|
| Train | 1,800 | ~900 | ~900 |
| Test | 200 | ~100 | ~100 |
| Parameter | Value |
|---|---|
| Base model | xlm-roberta-base |
| Epochs | 3 |
| Batch size | 16 |
| Learning rate | 2e-5 |
| Weight decay | 0.01 |
| Warmup ratio | 0.1 |
| Max sequence length | 128 |
| Optimizer | AdamW |
| Precision | FP16 |
| Metric | Score |
|---|---|
| Accuracy | 100.0% |
| F1 Score | 100.0% |
| Precision | 100.0% |
| Recall | 100.0% |
precision recall f1-score support
normal 1.00 1.00 1.00 106
spam 1.00 1.00 1.00 94
accuracy 1.00 200
macro avg 1.00 1.00 1.00 200
weighted avg 1.00 1.00 1.00 200Note: The perfect scores are due to the synthetic nature of the training data, where spam and normal messages have distinct, learnable patterns. Real-world performance may vary with organic messages that have more subtle spam indicators.
1@misc{uzbek-spam-detector,
2 author = {Sukhrob Nurali},
3 title = {Uzbek Spam Detector: Fine-tuned XLM-RoBERTa for Uzbek Spam Classification},
4 year = {2025},
5 publisher = {HuggingFace},
6 url = {https://huggingface.co/sukhrobnurali/uzbek-spam-detector}
7}