Downloads · 30 days
4
8% of all-time downloads
Kaleemullah/bert-base-uncased-ad-nonad-classifer
bert-base-uncased-ad-nonad-classifer is a text classification model from Kaleemullah. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
This model is a fine-tuned version of bert-base-uncased, specifically tailored for distinguishing between advertising (ad) and non-advertising (non-ad) text content. It is designed to understand the nuances and langua…
Downloads · 30 days
4
8% of all-time downloads
All-time downloads
52
Public
Parameters
109M
438 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors438 MB · 100%
From the Hugging Face model README
This model is a fine-tuned version of bert-base-uncased, specifically tailored for distinguishing between advertising (ad) and non-advertising (non-ad) text content. It is designed to understand the nuances and language patterns that differentiate promotional content from other types of text.
The model was trained on a balanced dataset consisting of 40,000 examples, with 20,000 ads and 20,000 non-ads. Each text entry was preprocessed and tokenized using the BERT tokenizer.
BertTokenizer with a maximum length of 512 tokens.transformers Trainer API.The model achieved the following metrics on the test dataset:
Note: this model meant to be update soon (it is overfitting on one Non-Ad Catagory (will be updated soon))
from transformers import BertTokenizer, BertForSequenceClassification
import torch
model_name = "Kaleemullah/bert-base-uncased-ad-nonad-classifier"
tokenizer = BertTokenizer.from_pretrained(model_name)
model = BertForSequenceClassification.from_pretrained(model_name)
def predict(text):
inputs = tokenizer(text, padding=True, truncation=True, max_length=512, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
prediction = torch.argmax(outputs.logits, dim=-1).numpy()[0]
return "Ad" if prediction == 1 else "Non-Ad"
# Example
predict("Your example text here")