https://huggingface.co/RUSpam/spam_deberta_v4 with ONNX weights to be compatible with Transformers PHP

RUSpam/spam_deberta_v4

Описание

Это модель определения спама, основанная на архитектуре Deberta, дообученная на русскоязычных данных о спаме. Она классифицирует текст как спам или не спам.

Использование

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

model_path = "RUSpam/spam_deberta_v4"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForSequenceClassification.from_pretrained(model_path)

def predict(text):
    inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=256)
    with torch.no_grad():
        outputs = model(**inputs)
        logits = outputs.logits
        predicted_class = torch.argmax(logits, dim=1).item()
    return "Спам" if predicted_class == 1 else "Не спам"

text = "Ваш текст для проверки здесь"
result = predict(text)
print(f"Результат: {result}")

Цитирование

@MISC{RUSpam/spam_deberta_v4,
    author  = {Denis Petrov, Kirill Fedko (Neurospacex),  Sergey Yalovegin},
    title   = {Russian Spam Classification Model},
    url     = {https://huggingface.co/RUSpam/spam_deberta_v4/},
    year    = 2024
}

Note: Having a separate repo for ONNX weights is intended to be a temporary solution until ONNXRuntime gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using 🤗 Optimum and structuring your repo like this one (with ONNX weights located in a subfolder named onnx).

Downloads last month
2
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API: The HF Inference API does not support text-classification models for Transformers PHP library.

Evaluation results