phishing-email-detector / model_utils.py
Med Amine
Deploy phishing email detector with trained model - F1: 98.78%
e7b7a72
raw
history blame contribute delete
858 Bytes
"""
Model utilities for loading pre-trained weights
"""
import torch
from transformers import AutoModel
def load_classifier_weights(model, weights_path="classifier_weights.pth"):
"""Load classification head weights into model"""
checkpoint = torch.load(weights_path, map_location="cpu")
model.classifier.load_state_dict(checkpoint['classifier_state_dict'])
return model
def get_model_info():
"""Return model metadata"""
return {
"name": "Phishing Email Detector",
"version": "1.0.0",
"author": "Mohamed Amine Marzouk",
"f1_score": 0.9878,
"precision": 0.9901,
"recall": 0.9854,
"auc_roc": 0.9991,
"training_time": "16 hours",
"inference_time": "82ms",
"training_data": "181,985 emails",
"model_type": "DistilRoBERTa-base + 5-layer MLP"
}