blanchefort commited on
Commit
1c43a54
1 Parent(s): 7554b16

commit from igor

Browse files
README.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RuBERT for Sentiment Analysis
2
+ Short Russian texts sentiment classification
3
+
4
+ This is a [DeepPavlov/rubert-base-cased-conversational](https://huggingface.co/DeepPavlov/rubert-base-cased-conversational) model trained on aggregated corpus of 351.797 texts.
5
+
6
+ ## Labels
7
+ 0: NEUTRAL
8
+ 1: POSITIVE
9
+ 2: NEGATIVE
10
+
11
+ ## How to use
12
+ ```python
13
+
14
+ import torch
15
+ from transformers import AutoModelForSequenceClassification
16
+ from transformers import BertTokenizerFast
17
+
18
+ tokenizer = BertTokenizerFast.from_pretrained('blanchefort/rubert-base-cased-sentiment')
19
+ model = AutoModelForSequenceClassification.from_pretrained('blanchefort/rubert-base-cased-sentiment', return_dict=True)
20
+
21
+ @torch.no_grad()
22
+ def predict(text):
23
+ inputs = tokenizer(text, max_length=512, padding=True, truncation=True, return_tensors='pt')
24
+ outputs = model(**inputs)
25
+ predicted = torch.nn.functional.softmax(outputs.logits, dim=1)
26
+ predicted = torch.argmax(predicted, dim=1).numpy()
27
+ return predicted
28
+ ```
29
+
30
+
31
+ ## Datasets used for model training
32
+
33
+ **[RuTweetCorp](https://study.mokoron.com/)**
34
+
35
+ > Рубцова Ю. Автоматическое построение и анализ корпуса коротких текстов (постов микроблогов) для задачи разработки и тренировки тонового классификатора //Инженерия знаний и технологии семантического веба. – 2012. – Т. 1. – С. 109-116.
36
+
37
+ **[RuReviews](https://github.com/sismetanin/rureviews)**
38
+
39
+ > RuReviews: An Automatically Annotated Sentiment Analysis Dataset for Product Reviews in Russian.
40
+
41
+ **[RuSentiment](http://text-machine.cs.uml.edu/projects/rusentiment/)**
42
+
43
+ > A. Rogers A. Romanov A. Rumshisky S. Volkova M. Gronas A. Gribov RuSentiment: An Enriched Sentiment Analysis Dataset for Social Media in Russian. Proceedings of COLING 2018.
44
+
45
+ **[Отзывы о медучреждениях](https://github.com/blanchefort/datasets/tree/master/medical_comments)**
46
+
47
+ > Датасет содержит пользовательские отзывы о медицинских учреждениях. Датасет собран в мае 2019 года с сайта prodoctorov.ru
config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "../huggingface/rubert-base-cased-sentiment",
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
+ "NEGATIVE": 2,
21
+ "NEUTRAL": 0,
22
+ "POSITIVE": 1
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:17c5e6f11e5672c158b12ed629edb94a2d5adfb0c0eacf55c21d250c7381dac1
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:a67fe65cc4493f7934b030d4b5fddbc2622edc062421101c5ba0b6c8b1a77c34
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": "DeepPavlov/rubert-base-cased-conversational", "do_basic_tokenize": true, "never_split": null}
vocab.txt ADDED
The diff for this file is too large to render. See raw diff