egoriya commited on
Commit
734bb23
1 Parent(s): acaf3db

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +44 -35
README.md CHANGED
@@ -1,42 +1,51 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
3
  ---
4
 
5
  This classification model is based on [sberbank-ai/ruRoberta-large](https://huggingface.co/sberbank-ai/ruRoberta-large).
6
- The model should be used to produce relevance and specificity of the last message in the context of a dialog.
7
-
8
- It is pretrained on corpus of dialog data from social networks and finetuned on [tinkoff-ai/context_similarity](https://huggingface.co/tinkoff-ai/context_similarity).
9
- The performance of the model on validation split [tinkoff-ai/context_similarity](https://huggingface.co/tinkoff-ai/context_similarity) (with the best thresholds for validation samples):
10
-
11
- <table>
12
- <thead>
13
- <tr>
14
- <td colspan="2">relevance</td>
15
- <td colspan="2">specificity</td>
16
- </tr>
17
- </thead>
18
- <tbody>
19
- <tr>
20
- <td>f0.5</td>
21
- <td>roc-auc</td>
22
- <td>f0.5</td>
23
- <td>roc-auc</td>
24
- </tr>
25
- <tr>
26
- <td>0.86</td>
27
- <td>0.83</td>
28
- <td>0.85</td>
29
- <td>0.86</td>
30
- </tr>
31
- </tbody>
32
- </table>
33
-
34
- The model can be loaded as follows:
35
 
36
  ```python
37
- # pip install transformers
38
- from transformers import AutoTokenizer, AutoModel
39
- tokenizer = AutoTokenizer.from_pretrained("tinkoff-ai/context_similarity")
40
- model = AutoModel.from_pretrained("tinkoff-ai/context_similarity")
41
- # model.cuda()
42
- ```
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ widget:
4
+ - text: "привет[SEP]привет![SEP]как дела?[RESPONSE_TOKEN]супер, вот только проснулся, у тебя как?"
5
+ example_title: "Dialog example 1"
6
+ - text: "привет[SEP]привет![SEP]как дела?[RESPONSE_TOKEN]норм"
7
+ example_title: "Dialog example 2"
8
+ - text: "привет[SEP]привет![SEP]как дела?[RESPONSE_TOKEN]норм, у тя как?"
9
+ example_title: "Dialog example 3"
10
  ---
11
 
12
  This classification model is based on [sberbank-ai/ruRoberta-large](https://huggingface.co/sberbank-ai/ruRoberta-large).
13
+ The model should be used to produce relevance and specificity of the last message in the context of a dialogue.
14
+
15
+ The labels explanation:
16
+ - `relevance`: is the last message in the dialogue relevant in the context of the full dialogue.
17
+ - `specificity`: is the last message in the dialogue interesting and promotes the continuation of the dialogue.
18
+
19
+ It is pretrained on a large corpus of dialog data in unsupervised manner: the model is trained to predict whether last response was in a real dialog, or it was pulled from some other dialog at random.
20
+ Then it was finetuned on manually labelled examples (dataset will be posted soon).
21
+
22
+ The model was trained with three messages in the context and one response. Each message was tokenized separately with ``` max_length = 32 ```.
23
+
24
+ The performance of the model on validation split (dataset will be posted soon) (with the best thresholds for validation samples):
25
+
26
+
27
+ | | threshold | f0.5 | ROC AUC |
28
+ |:------------|------------:|-------:|----------:|
29
+ | relevance | 0.59 | 0.86 | 0.83 |
30
+ | specificity | 0.61 | 0.85 | 0.86 |
31
+
32
+
33
+ How to use:
 
 
 
 
 
 
 
 
34
 
35
  ```python
36
+ pip install transformers
37
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
38
+ import torch
39
+ tokenizer = AutoTokenizer.from_pretrained('tinkoff-ai/response-quality-classifier-large')
40
+ model = AutoModelForSequenceClassification.from_pretrained('tinkoff-ai/response-quality-classifier-large')
41
+ model.cuda()
42
+ inputs = tokenizer('[CLS]привет[SEP]привет![SEP]как дела?[RESPONSE_TOKEN]норм, у тя как?', max_length=128, add_special_tokens=False, return_tensors='pt')
43
+ with torch.inference_mode():
44
+ logits = model(**inputs).logits
45
+ probas = torch.sigmoid(logits)[0].cpu().detach().numpy()
46
+ relevance, specificity = probas
47
+ ```
48
+
49
+ The [app](https://huggingface.co/spaces/tinkoff-ai/response-quality-classifiers) where you can easily interact with this model.
50
+
51
+ The work was done during internship at Tinkoff by [egoriyaa](https://github.com/egoriyaa), mentored by [solemn-leader](https://huggingface.co/solemn-leader).