Angelectronic wonrax commited on
Commit
d241e8a
0 Parent(s):

Duplicate from wonrax/phobert-base-vietnamese-sentiment

Browse files

Co-authored-by: Ha Huy Long Hai <[email protected]>

.gitattributes ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ftz filter=lfs diff=lfs merge=lfs -text
6
+ *.gz filter=lfs diff=lfs merge=lfs -text
7
+ *.h5 filter=lfs diff=lfs merge=lfs -text
8
+ *.joblib filter=lfs diff=lfs merge=lfs -text
9
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
10
+ *.model filter=lfs diff=lfs merge=lfs -text
11
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
12
+ *.onnx filter=lfs diff=lfs merge=lfs -text
13
+ *.ot filter=lfs diff=lfs merge=lfs -text
14
+ *.parquet filter=lfs diff=lfs merge=lfs -text
15
+ *.pb filter=lfs diff=lfs merge=lfs -text
16
+ *.pt filter=lfs diff=lfs merge=lfs -text
17
+ *.pth filter=lfs diff=lfs merge=lfs -text
18
+ *.rar filter=lfs diff=lfs merge=lfs -text
19
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
20
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
21
+ *.tflite filter=lfs diff=lfs merge=lfs -text
22
+ *.tgz filter=lfs diff=lfs merge=lfs -text
23
+ *.wasm filter=lfs diff=lfs merge=lfs -text
24
+ *.xz filter=lfs diff=lfs merge=lfs -text
25
+ *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - vi
4
+ tags:
5
+ - sentiment
6
+ - classification
7
+ license: mit
8
+ widget:
9
+ - text: "Không thể nào đẹp hơn"
10
+ - text: "Quá phí tiền, mà không đẹp"
11
+ - text: "Cái này giá ổn không nhỉ?"
12
+
13
+ ---
14
+
15
+ [**GitHub Homepage**](https://github.com/wonrax/phobert-base-vietnamese-sentiment)
16
+
17
+ A model fine-tuned for sentiment analysis based on [vinai/phobert-base](https://huggingface.co/vinai/phobert-base).
18
+
19
+ Labels:
20
+ - NEG: Negative
21
+ - POS: Positive
22
+ - NEU: Neutral
23
+
24
+ Dataset: [30K e-commerce reviews](https://www.kaggle.com/datasets/linhlpv/vietnamese-sentiment-analyst)
25
+
26
+ ## Usage
27
+ ```python
28
+ import torch
29
+ from transformers import RobertaForSequenceClassification, AutoTokenizer
30
+
31
+ model = RobertaForSequenceClassification.from_pretrained("wonrax/phobert-base-vietnamese-sentiment")
32
+
33
+ tokenizer = AutoTokenizer.from_pretrained("wonrax/phobert-base-vietnamese-sentiment", use_fast=False)
34
+
35
+ # Just like PhoBERT: INPUT TEXT MUST BE ALREADY WORD-SEGMENTED!
36
+ sentence = 'Đây là mô_hình rất hay , phù_hợp với điều_kiện và như cầu của nhiều người .'
37
+
38
+ input_ids = torch.tensor([tokenizer.encode(sentence)])
39
+
40
+ with torch.no_grad():
41
+ out = model(input_ids)
42
+ print(out.logits.softmax(dim=-1).tolist())
43
+ # Output:
44
+ # [[0.002, 0.988, 0.01]]
45
+ # ^ ^ ^
46
+ # NEG POS NEU
47
+ ```
added_tokens.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"<mask>": 64000}
bpe.codes ADDED
The diff for this file is too large to render. See raw diff
 
config.json ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/content/drive/MyDrive/thesis/models/ecomm-review-phobert-base-5epochs",
3
+ "architectures": [
4
+ "RobertaForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
8
+ "classifier_dropout": null,
9
+ "eos_token_id": 2,
10
+ "gradient_checkpointing": false,
11
+ "hidden_act": "gelu",
12
+ "hidden_dropout_prob": 0.1,
13
+ "hidden_size": 768,
14
+ "id2label": {
15
+ "0": "NEG",
16
+ "1": "POS",
17
+ "2": "NEU"
18
+ },
19
+ "initializer_range": 0.02,
20
+ "intermediate_size": 3072,
21
+ "label2id": {
22
+ "NEG": 0,
23
+ "NEU": 2,
24
+ "POS": 1
25
+ },
26
+ "layer_norm_eps": 1e-05,
27
+ "max_position_embeddings": 258,
28
+ "model_type": "roberta",
29
+ "num_attention_heads": 12,
30
+ "num_hidden_layers": 12,
31
+ "pad_token_id": 1,
32
+ "position_embedding_type": "absolute",
33
+ "problem_type": "single_label_classification",
34
+ "tokenizer_class": "PhobertTokenizer",
35
+ "torch_dtype": "float32",
36
+ "transformers_version": "4.18.0",
37
+ "type_vocab_size": 1,
38
+ "use_cache": true,
39
+ "vocab_size": 64001
40
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c09addc0848350e599eaba524a84fadd1339d1be8b96e724338c5804f8eb8b40
3
+ size 540069101
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"bos_token": "<s>", "eos_token": "</s>", "unk_token": "<unk>", "sep_token": "</s>", "pad_token": "<pad>", "cls_token": "<s>", "mask_token": "<mask>"}
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"bos_token": "<s>", "eos_token": "</s>", "unk_token": "<unk>", "sep_token": "</s>", "cls_token": "<s>", "pad_token": "<pad>", "mask_token": "<mask>", "model_max_length": 256, "special_tokens_map_file": null, "name_or_path": "vinai/phobert-base", "tokenizer_class": "PhobertTokenizer"}
vocab.txt ADDED
The diff for this file is too large to render. See raw diff