Quintu commited on
Commit
42c62fd
·
verified ·
1 Parent(s): 8f19873

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +88 -3
README.md CHANGED
@@ -1,3 +1,88 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model:
4
+ - microsoft/deberta-v3-large
5
+ ---
6
+ Multi-Task Product and Hazard Classifier
7
+ 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.
8
+ Model Description
9
+
10
+ Model Type: Multi-task classification (DeBERTa-v3 base)
11
+ Languages: English
12
+ Pipeline Tag: text-classification
13
+ Max Sequence Length: 1024 tokens
14
+
15
+ Usage
16
+ pythonCopyfrom transformers import AutoTokenizer, AutoModel
17
+ import torch
18
+ from torch.nn import functional as F
19
+
20
+ # Load model and tokenizer
21
+ tokenizer = AutoTokenizer.from_pretrained("your-username/model-name")
22
+ model = AutoModel.from_pretrained("your-username/model-name")
23
+
24
+ # Prepare your text
25
+ text = "Your product description here"
26
+
27
+ # Tokenize and prepare input
28
+ inputs = tokenizer(
29
+ text,
30
+ padding=True,
31
+ truncation=True,
32
+ max_length=1024,
33
+ return_tensors="pt",
34
+ return_token_type_ids=False
35
+ )
36
+
37
+ # Run inference
38
+ with torch.no_grad():
39
+ outputs = model(**inputs)
40
+ product_logits = outputs['product_logits']
41
+ hazard_logits = outputs['hazard_logits']
42
+
43
+ product_probs = F.softmax(product_logits, dim=-1)
44
+ hazard_probs = F.softmax(hazard_logits, dim=-1)
45
+
46
+ # Get predictions
47
+ product_predictions = product_probs.cpu().numpy()
48
+ hazard_predictions = hazard_probs.cpu().numpy()
49
+ Prediction Labels
50
+ Product Categories
51
+ pythonCopyproduct_labels = {
52
+ '0': 'label_0',
53
+ '1': 'label_1',
54
+ # Add your product category labels here
55
+ }
56
+ Hazard Categories
57
+ pythonCopyhazard_labels = {
58
+ '0': 'label_0',
59
+ '1': 'label_1',
60
+ # Add your hazard category labels here
61
+ }
62
+ Model Limitations
63
+
64
+ The model is designed for English text only
65
+ Maximum input length is 1024 tokens
66
+ Performance may vary for texts significantly different from the training data
67
+
68
+ Training Data
69
+ 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.
70
+ Evaluation Results
71
+ [Add your model's evaluation metrics here]
72
+ Intended Uses & Limitations
73
+ Intended Uses:
74
+
75
+ Product categorization
76
+ Hazard identification in product descriptions
77
+ Safety analysis of product text
78
+
79
+ Limitations:
80
+
81
+ Should not be used as the sole decision maker for safety-critical applications
82
+ Requires human verification for important safety decisions
83
+ May not recognize new or unusual product types/hazards
84
+
85
+ Citation
86
+ [Add citation information if applicable]
87
+ Contact
88
+ [Your contact information or where to report issues]