blanchefort commited on
Commit
5f21fb3
1 Parent(s): 037f2e1

Initial commit

Browse files
README.md ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - ru
4
+ tags:
5
+ - sentiment
6
+ - text-classification
7
+ ---
8
+
9
+ # RuBERT for Sentiment Analysis of Medical Reviews
10
+
11
+ This is a [DeepPavlov/rubert-base-cased-conversational](https://huggingface.co/DeepPavlov/rubert-base-cased-conversational) model trained on corpus of medical reviews.
12
+
13
+ ## Labels
14
+ 0: NEUTRAL
15
+ 1: POSITIVE
16
+ 2: NEGATIVE
17
+
18
+ ## How to use
19
+ ```python
20
+
21
+ import torch
22
+ from transformers import AutoModelForSequenceClassification
23
+ from transformers import BertTokenizerFast
24
+
25
+ tokenizer = BertTokenizerFast.from_pretrained('blanchefort/rubert-base-cased-sentiment-med')
26
+ model = AutoModelForSequenceClassification.from_pretrained('blanchefort/rubert-base-cased-sentiment-med', return_dict=True)
27
+
28
+ @torch.no_grad()
29
+ def predict(text):
30
+ inputs = tokenizer(text, max_length=512, padding=True, truncation=True, return_tensors='pt')
31
+ outputs = model(**inputs)
32
+ predicted = torch.nn.functional.softmax(outputs.logits, dim=1)
33
+ predicted = torch.argmax(predicted, dim=1).numpy()
34
+ return predicted
35
+ ```
36
+
37
+
38
+ ## Dataset used for model training
39
+
40
+ **[Отзывы о медучреждениях](https://github.com/blanchefort/datasets/tree/master/medical_comments)**
41
+
42
+ > Датасет содержит пользовательские отзывы о медицинских учреждениях. Датасет собран в мае 2019 года с сайта prodoctorov.ru
config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "blanchefort/rubert-base-cased-sentiment-med",
3
+ "architectures": [
4
+ "BertForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "directionality": "bidi",
8
+ "gradient_checkpointing": false,
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 768,
12
+ "id2label": {
13
+ "0": "NEUTRAL",
14
+ "1": "POSITIVE",
15
+ "2": "NEGATIVE"
16
+ },
17
+ "initializer_range": 0.02,
18
+ "intermediate_size": 3072,
19
+ "label2id": {
20
+ "NEUTRAL": 0,
21
+ "POSITIVE": 1,
22
+ "NEGATIVE": 2
23
+ },
24
+ "layer_norm_eps": 1e-12,
25
+ "max_position_embeddings": 512,
26
+ "model_type": "bert",
27
+ "num_attention_heads": 12,
28
+ "num_hidden_layers": 12,
29
+ "output_past": true,
30
+ "pad_token_id": 0,
31
+ "pooler_fc_size": 768,
32
+ "pooler_num_attention_heads": 12,
33
+ "pooler_num_fc_layers": 3,
34
+ "pooler_size_per_head": 128,
35
+ "pooler_type": "first_token_transform",
36
+ "return_dict": true,
37
+ "type_vocab_size": 2,
38
+ "vocab_size": 119547
39
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4268808e1769197a140ed9c419f40a20edad82521bbf7aed98f503a957094cad
3
+ size 711509513
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
tf_model.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e5c8e782a85adee5ea32a7c3d269232e2eb3dd782539b3f0618dda5a3de62a71
3
+ size 711693676
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"do_lower_case": false, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "special_tokens_map_file": "/home/igor/.cache/torch/transformers/1f428acdde727eed5de979d6856ce350a470be2a64e134a1fdae04af78a27301.dd8bd9bfd3664b530ea4e645105f557769387b3da9f79bdb55ed556bdd80611d", "name_or_path": "blanchefort/rubert-base-cased-sentiment", "do_basic_tokenize": true, "never_split": null}
vocab.txt ADDED
The diff for this file is too large to render. See raw diff