blanchefort commited on
Commit
c1038d7
1 Parent(s): a48f911

Initial commit

Browse files
README.md ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - ru
4
+ tags:
5
+ - sentiment
6
+ - text-classification
7
+ datasets:
8
+ - RuSentiment
9
+ ---
10
+
11
+ # RuBERT for Sentiment Analysis
12
+
13
+ This is a [DeepPavlov/rubert-base-cased-conversational](https://huggingface.co/DeepPavlov/rubert-base-cased-conversational) model trained on [RuSentiment](http://text-machine.cs.uml.edu/projects/rusentiment/).
14
+
15
+ ## Labels
16
+ 0: NEUTRAL
17
+ 1: POSITIVE
18
+ 2: NEGATIVE
19
+
20
+ ## How to use
21
+ ```python
22
+
23
+ import torch
24
+ from transformers import AutoModelForSequenceClassification
25
+ from transformers import BertTokenizerFast
26
+
27
+ tokenizer = BertTokenizerFast.from_pretrained('blanchefort/rubert-base-cased-sentiment-rusentiment')
28
+ model = AutoModelForSequenceClassification.from_pretrained('blanchefort/rubert-base-cased-sentiment-rusentiment', return_dict=True)
29
+
30
+ @torch.no_grad()
31
+ def predict(text):
32
+ inputs = tokenizer(text, max_length=512, padding=True, truncation=True, return_tensors='pt')
33
+ outputs = model(**inputs)
34
+ predicted = torch.nn.functional.softmax(outputs.logits, dim=1)
35
+ predicted = torch.argmax(predicted, dim=1).numpy()
36
+ return predicted
37
+ ```
38
+
39
+
40
+ ## Dataset used for model training
41
+
42
+ **[RuSentiment](http://text-machine.cs.uml.edu/projects/rusentiment/)**
43
+
44
+ > 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.
config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "blanchefort/rubert-base-cased-sentiment-rusentiment",
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:b12831c8ff521e1426db1cd19963ec26e53a6deae877bbb1facb1fde5bdc9635
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:520fd9e0cb20b23a4f2df20ba9ed1a56daccfe131fe853262d76cf67a282da87
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