blanchefort commited on
Commit
07956a6
1 Parent(s): e022d48

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
+ - RuReviews
9
+ ---
10
+
11
+ # RuBERT for Sentiment Analysis of Product Reviews
12
+
13
+ This is a [DeepPavlov/rubert-base-cased-conversational](https://huggingface.co/DeepPavlov/rubert-base-cased-conversational) model trained on [RuReviews](https://github.com/sismetanin/rureviews).
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-rurewiews')
28
+ model = AutoModelForSequenceClassification.from_pretrained('blanchefort/rubert-base-cased-sentiment-rurewiews', 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
+ **[RuReviews](https://github.com/sismetanin/rureviews)**
43
+
44
+ > RuReviews: An Automatically Annotated Sentiment Analysis Dataset for Product Reviews in Russian.
config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "blanchefort/rubert-base-cased-sentiment-rurewiews",
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:b9e725c0eb435114f2084c2d4323939c432f355ce314049cf8ccbd8df5995381
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:11ba250a07bf59210d6f7f9512d8607c67da70a8ecf03d0331285dd82ba40a3b
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