This model is a fine‑tuned version of
DistilBERT‑base‑uncased for binary classification of SMS messages as
ham (0) or
spam (1).
It was trained on the
UCI SMS Spam Collection, which contains 5,574 labeled SMS messages.
1from transformers import pipeline
2
3classifier = pipeline("text-classification", model="lorcannrauzduel/distilbert-sms-spam")
4result = classifier("WINNER!! You've won a free iPhone!")
5print(result) # [{'label': 'spam', 'score': 0.998}]
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4model_name = "lorcannrauzduel/distilbert-sms-spam"
5tokenizer = AutoTokenizer.from_pretrained(model_name)
6model = AutoModelForSequenceClassification.from_pretrained(model_name)
7
8def predict(text):
9 inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
10 with torch.no_grad():
11 logits = model(**inputs).logits
12 return model.config.id2label[logits.argmax().item()]
13
14print(predict("See you at the meeting tomorrow")) # ham
1from transformers import pipeline
2
3classifier = pipeline("text-classification", model="lorcannrauzduel/distilbert-sms-spam")
4print(classifier("Congratulations! You've been selected as a winner."))
The test set contains 837 messages (15% of the full dataset), with the same class proportion as the original.
Apache 2.0 (same as the original DistilBERT).