ad-classifier-v0.0 / README.md
jmvcoelho's picture
Update README.md
6de9b24 verified
|
raw
history blame contribute delete
1.66 kB
---
language:
- en
base_model:
- microsoft/deberta-v3-base
pipeline_tag: text-classification
---
Binary classification model for ad-detection on QA Systems.
## Sample usage
```python
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
classifier_model_path = "jmvcoelho/ad-classifier-v0.0"
tokenizer = AutoTokenizer.from_pretrained(classifier_model_path)
model = AutoModelForSequenceClassification.from_pretrained(classifier_model_path)
model.eval()
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
def classify(passages):
inputs = tokenizer(
passages, padding=True, truncation=True, max_length=512, return_tensors="pt"
)
inputs = {k: v.to(device) for k, v in inputs.items()}
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
predictions = torch.argmax(logits, dim=-1)
return predictions.cpu().tolist()
preds = classify(["sample_text_1", "sample_text_2"])
```
## Version
- **v0.0:** Trained with the official data from Webis Generated Native Ads 2024
- v0.1: Trained with v0.0 data + new synthetic data
## Webis Generated Native Ads 2024
**Paper:** [Detecting Generated Native Ads in Conversational Search](https://dl.acm.org/doi/10.1145/3589335.3651489)
**Data summary:**
- YouChat and Microsoft Copilot were used to generate answers for competitve keywork queries;
- GPT-4 turbo was used to insert one advertisment into the answer;
- This creates triples (query, answer_with_ad, answer_without_ad)
- The classifier in this repo was trained to assign 0 to answer_without_ad, and 1 to answer_with_ad.