AventIQ-AI / distilBERT_spam_detection

huggingface.co
Total runs: 11
24-hour runs: 0
7-day runs: 3
30-day runs: 8
Model's Last Updated: May 09 2025

Introduction of distilBERT_spam_detection

Model Details of distilBERT_spam_detection

๐Ÿ“ฉ DistilBERT Quantized Model for SMS Spam Detection

This repository contains a production-ready quantized DistilBERT model fine-tuned for SMS spam classification , achieving 99.94% accuracy while optimizing inference speed using ONNX Runtime.


๐Ÿ“Œ Model Details
  • Model Architecture: DistilBERT Base Uncased
  • Task: Binary SMS Spam Classification ( ham=0 , spam=1 )
  • Dataset: Custom SMS Spam Collection (5,574 messages)
  • Quantization: ONNX Runtime Dynamic Quantization
  • Fine-tuning Framework: Hugging Face Transformers + Optimum

๐Ÿš€ Quick Start
๐Ÿงฐ Installation
pip install -r requirements.txt
โœ… Basic Usage
from transformers import pipeline

classifier = pipeline(
    "text-classification",
    model="./spam_model_quantized",
    tokenizer="./spam_model"
)

sample = "WINNER!! Claim your $1000 prize now!"
result = classifier(sample)
print(f"Prediction: {result[0]['label']} (confidence: {result[0]['score']:.2%})")

๐Ÿ“ˆ Performance Metrics
Metric Value
Accuracy 99.94%
F1 Score 0.9977
Precision 100%
Recall 99.55%
Inference* 2.7ms

* Tested on AWS t3.xlarge (4 vCPUs)


๐Ÿ›  Advanced Usage
๐Ÿ” Load Quantized Model Directly
from optimum.onnxruntime import ORTModelForSequenceClassification

model = ORTModelForSequenceClassification.from_pretrained(
    "./spam_model_quantized",
    provider="CPUExecutionProvider"
)
๐Ÿ“Š Batch Processing
import pandas as pd

df = pd.read_csv("messages.csv")
predictions = classifier(list(df["text"]), batch_size=32)

๐ŸŽฏ Training Details
๐Ÿ”ง Hyperparameters
Parameter Value
Epochs 5 (early stopped at 3)
Batch Size 12 (train), 16 (eval)
Learning Rate 3e-5
Warmup Steps 10% of data
Weight Decay 0.01
โšก Quantization Benefits
Metric Original Quantized
Model Size 255MB 68MB
CPU Latency 9.2ms 2.7ms
Throughput 110/sec 380/sec

๐Ÿ“ Repository Structure
.
โ”œโ”€โ”€ spam_model/               # Original PyTorch model
โ”‚   โ”œโ”€โ”€ config.json
โ”‚   โ”œโ”€โ”€ model.safetensors
โ”‚   โ””โ”€โ”€ tokenizer.json
โ”œโ”€โ”€ spam_model_quantized/     # Production-ready quantized model
โ”‚   โ”œโ”€โ”€ model.onnx
โ”‚   โ”œโ”€โ”€ quantized_model.onnx
โ”‚   โ””โ”€โ”€ tokenizer_config.json
โ”œโ”€โ”€ examples/                 # Ready-to-use scripts
โ”‚   โ”œโ”€โ”€ predict.py            # CLI interface
โ”‚   โ””โ”€โ”€ api_server.py         # FastAPI service
โ”œโ”€โ”€ requirements.txt          # Dependencies
โ””โ”€โ”€ README.md                 # This document

๐Ÿš€ Deployment Options
1. Local REST API
uvicorn examples.api_server:app --port 8000
2. Docker Container
FROM python:3.9-slim
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
CMD ["uvicorn", "examples.api_server:app", "--host", "0.0.0.0"]

โš ๏ธ Limitations
  • Optimized for English SMS messages
  • May require retraining for regional language or localized spam patterns
  • Quantized model requires x86 CPUs with AVX2 support

๐Ÿ™Œ Contributions

Pull requests and suggestions are welcome! Please open an issue for feature requests or bug reports.

Runs of AventIQ-AI distilBERT_spam_detection on huggingface.co

11
Total runs
0
24-hour runs
0
3-day runs
3
7-day runs
8
30-day runs

More Information About distilBERT_spam_detection huggingface.co Model

distilBERT_spam_detection huggingface.co

distilBERT_spam_detection huggingface.co is an AI model on huggingface.co that provides distilBERT_spam_detection's model effect (), which can be used instantly with this AventIQ-AI distilBERT_spam_detection model. huggingface.co supports a free trial of the distilBERT_spam_detection model, and also provides paid use of the distilBERT_spam_detection. Support call distilBERT_spam_detection model through api, including Node.js, Python, http.

distilBERT_spam_detection huggingface.co Url

https://huggingface.co/AventIQ-AI/distilBERT_spam_detection

AventIQ-AI distilBERT_spam_detection online free

distilBERT_spam_detection huggingface.co is an online trial and call api platform, which integrates distilBERT_spam_detection's modeling effects, including api services, and provides a free online trial of distilBERT_spam_detection, you can try distilBERT_spam_detection online for free by clicking the link below.

AventIQ-AI distilBERT_spam_detection online free url in huggingface.co:

https://huggingface.co/AventIQ-AI/distilBERT_spam_detection

distilBERT_spam_detection install

distilBERT_spam_detection is an open source model from GitHub that offers a free installation service, and any user can find distilBERT_spam_detection on GitHub to install. At the same time, huggingface.co provides the effect of distilBERT_spam_detection install, users can directly use distilBERT_spam_detection installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

distilBERT_spam_detection install url in huggingface.co:

https://huggingface.co/AventIQ-AI/distilBERT_spam_detection

Url of distilBERT_spam_detection

distilBERT_spam_detection huggingface.co Url

Provider of distilBERT_spam_detection huggingface.co

AventIQ-AI
ORGANIZATIONS

Other API from AventIQ-AI

huggingface.co

Total runs: 18
Run Growth: 14
Growth Rate: 77.78%
Updated:February 17 2025