egoriya commited on
Commit
f168f1b
1 Parent(s): e363ca3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +48 -0
README.md CHANGED
@@ -1,3 +1,51 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 [DeepPavlov/rubert-base-cased-sentence](https://huggingface.co/DeepPavlov/rubert-base-cased-sentence).
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.49 | 0.84 | 0.79 |
30
+ | specificity | 0.53 | 0.83 | 0.83 |
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-base')
40
+ model = AutoModelForSequenceClassification.from_pretrained('tinkoff-ai/response-quality-classifier-base')
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).