Update README.md
Browse filesdocs: adding the example of using with BERT class
README.md
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
language:
|
4 |
-
- ru
|
5 |
-
metrics:
|
6 |
-
- accuracy
|
7 |
-
base_model:
|
8 |
-
- ai-forever/ruRoberta-large
|
9 |
-
pipeline_tag: text-classification
|
10 |
-
tags:
|
11 |
-
- reviews
|
12 |
-
- e-commercy
|
13 |
-
- foodtech
|
14 |
-
---
|
15 |
# Food Delivery Feedback Multi-Label Classification Model
|
16 |
|
17 |
This model was developed for multi-label classification of customer feedback in the food delivery domain. It can identify up to 50 different aspects/issues from user reviews and feedback messages.
|
@@ -85,4 +85,37 @@ The model was trained as part of an NLP competition focused on improving custome
|
|
85 |
|
86 |
- Primarily optimized for Russian language feedback
|
87 |
- May require fine-tuning for specific regional contexts
|
88 |
-
- Best suited for food delivery domain specifically
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- ru
|
5 |
+
metrics:
|
6 |
+
- accuracy
|
7 |
+
base_model:
|
8 |
+
- ai-forever/ruRoberta-large
|
9 |
+
pipeline_tag: text-classification
|
10 |
+
tags:
|
11 |
+
- reviews
|
12 |
+
- e-commercy
|
13 |
+
- foodtech
|
14 |
+
---
|
15 |
# Food Delivery Feedback Multi-Label Classification Model
|
16 |
|
17 |
This model was developed for multi-label classification of customer feedback in the food delivery domain. It can identify up to 50 different aspects/issues from user reviews and feedback messages.
|
|
|
85 |
|
86 |
- Primarily optimized for Russian language feedback
|
87 |
- May require fine-tuning for specific regional contexts
|
88 |
+
- Best suited for food delivery domain specifically
|
89 |
+
|
90 |
+
## How to use with PyTorch and Transfomers
|
91 |
+
|
92 |
+
```python
|
93 |
+
import torch
|
94 |
+
from transformers import RobertaTokenizer, RobertaForSequenceClassification
|
95 |
+
|
96 |
+
|
97 |
+
model_name = 'metanovus/ruroberta-ecom-tech-best'
|
98 |
+
device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
|
99 |
+
|
100 |
+
tokenizer = RobertaTokenizer.from_pretrained(model_name)
|
101 |
+
|
102 |
+
class BERTClass(torch.nn.Module):
|
103 |
+
def __init__(self):
|
104 |
+
super(BERTClass, self).__init__()
|
105 |
+
self.bert_model = RobertaForSequenceClassification.from_pretrained(
|
106 |
+
model_name,
|
107 |
+
return_dict=True,
|
108 |
+
problem_type='multi_label_classification',
|
109 |
+
num_labels=50
|
110 |
+
)
|
111 |
+
|
112 |
+
def forward(self, input_ids, attn_mask, token_type_ids):
|
113 |
+
output = self.bert_model(
|
114 |
+
input_ids,
|
115 |
+
attention_mask=attn_mask,
|
116 |
+
token_type_ids=token_type_ids
|
117 |
+
)
|
118 |
+
return output.logits
|
119 |
+
|
120 |
+
model = BERTClass().to(device)
|
121 |
+
```
|