File size: 2,845 Bytes
42c62fd 5781fd3 42c62fd 627a1c4 42c62fd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
---
license: apache-2.0
base_model:
- microsoft/deberta-v3-large
language: en
tags:
- text-classification
- product-detection
- hazard-detection
datasets:
- your-dataset-name
library_name: transformers
pipeline_tag: text-classification
---
Multi-Task Product and Hazard Classifier
This model performs multi-task classification to predict both product categories and hazard categories from text descriptions. It's based on DeBERTa-v3 architecture and trained to identify product types and potential hazards simultaneously.
Model Description
Model Type: Multi-task classification (DeBERTa-v3 large)
Languages: English
Pipeline Tag: text-classification
Max Sequence Length: 1024 tokens
Usage
pythonCopyfrom transformers import AutoTokenizer, AutoModel
import torch
from torch.nn import functional as F
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("your-username/model-name")
model = AutoModel.from_pretrained("your-username/model-name")
# Prepare your text
text = "Your product description here"
# Tokenize and prepare input
inputs = tokenizer(
text,
padding=True,
truncation=True,
max_length=1024,
return_tensors="pt",
return_token_type_ids=False
)
# Run inference
with torch.no_grad():
outputs = model(**inputs)
product_logits = outputs['product_logits']
hazard_logits = outputs['hazard_logits']
product_probs = F.softmax(product_logits, dim=-1)
hazard_probs = F.softmax(hazard_logits, dim=-1)
# Get predictions
product_predictions = product_probs.cpu().numpy()
hazard_predictions = hazard_probs.cpu().numpy()
Prediction Labels
Product Categories
pythonCopyproduct_labels = {
'0': 'label_0',
'1': 'label_1',
# Add your product category labels here
}
Hazard Categories
pythonCopyhazard_labels = {
'0': 'label_0',
'1': 'label_1',
# Add your hazard category labels here
}
Model Limitations
The model is designed for English text only
Maximum input length is 1024 tokens
Performance may vary for texts significantly different from the training data
Training Data
The model was trained on a dataset containing product descriptions with their corresponding product categories and hazard classifications. The training data includes various product types and potential hazards commonly found in consumer products.
Evaluation Results
[Add your model's evaluation metrics here]
Intended Uses & Limitations
Intended Uses:
Product categorization
Hazard identification in product descriptions
Safety analysis of product text
Limitations:
Should not be used as the sole decision maker for safety-critical applications
Requires human verification for important safety decisions
May not recognize new or unusual product types/hazards
Citation
[Add citation information if applicable]
Contact
[Your contact information or where to report issues] |