Downloads · 30 days
18
23% of all-time downloads
patelkrish2727/jarvis-email
jarvis-email is a machine learning model from patelkrish2727. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Custom multi-head email classifier on microsoft/deberta-v3-small.
Downloads · 30 days
18
23% of all-time downloads
All-time downloads
79
Public
Repo size
565 MB
Likes
0
Public
Click a slice to open those files.
.bin565 MB · 100%
From the Hugging Face model README
Custom multi-head email classifier on microsoft/deberta-v3-small.
Heads:
category (11): finance, government, newsletters, other, personal, promotions, security, socials, spam, verification_codes, workintent (10): financial_transaction, government_notice, information_update, meeting_request, other, promotional_offer, security_alert, social_notification, task_action, verification_codeactionability (5): needs_click, needs_payment, needs_reply, needs_scheduling, none_fyithreat_verdict (5): fraud_bec, impersonated, legitimate, phishing, suspiciousattack_vector (6): credential_harvesting, fake_invoice, malicious_link, none, payment_diversion, social_engineeringpytorch_model.bin — full state_dict (540MB, fp32)modeling_jarvis.py — model class JarvisEmailIntelligenceconfig.json — dims + label listslabel_encoders.pkl — sklearn LabelEncoders (sklearn 1.6.1)label_mappings.json — same labels as JSONimport pickle, torch
from transformers import AutoTokenizer
from modeling_jarvis import JarvisEmailIntelligence
REPO = "patelkrish2727/jarvis-email"
tok = AutoTokenizer.from_pretrained("microsoft/deberta-v3-small")
encoders = pickle.load(open("label_encoders.pkl","rb"))
model = JarvisEmailIntelligence(
model_name="microsoft/deberta-v3-small",
n_category=len(encoders['category'].classes_),
n_intent=len(encoders['intent'].classes_),
n_actionability=len(encoders['actionability'].classes_),
n_threat_verdict=len(encoders['threat_verdict'].classes_),
n_attack_vector=len(encoders['attack_vector'].classes_),
)
state = torch.load("pytorch_model.bin", map_location="cpu")
model.load_state_dict(state); model.eval()
text = "Subject: Hello\n\nBody: test"
e = tok(text, truncation=True, padding='max_length', max_length=384, return_tensors='pt')
with torch.no_grad():
print(model(e['input_ids'], e['attention_mask']))
Max length: 384. Input format: Subject: {subject}\n\nBody: {body}.