Agra2002 commited on
Commit
ab7efea
·
1 Parent(s): bf35754

Upload 11 files

Browse files
README.md ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: id
3
+ tags:
4
+ - indonesian-roberta-base-indolem-sentiment-classifier-fold-0
5
+ license: mit
6
+ datasets:
7
+ - indolem
8
+ widget:
9
+ - text: "Pelayanan hotel ini sangat baik."
10
+ ---
11
+
12
+ ## Indonesian RoBERTa Base IndoLEM Sentiment Classifier
13
+
14
+ Indonesian RoBERTa Base IndoLEM Sentiment Classifier is a sentiment-text-classification model based on the [RoBERTa](https://arxiv.org/abs/1907.11692) model. The model was originally the pre-trained [Indonesian RoBERTa Base](https://hf.co/flax-community/indonesian-roberta-base) model, which is then fine-tuned on [`indolem`](https://indolem.github.io/)'s [Sentiment Analysis](https://github.com/indolem/indolem/tree/main/sentiment) dataset consisting of Indonesian tweets and hotel reviews (Koto et al., 2020).
15
+
16
+ A 5-fold cross-validation experiment was performed, with splits provided by the original dataset authors. This model was trained on fold 0. You can find models trained on [fold 0](https://huggingface.co/w11wo/indonesian-roberta-base-indolem-sentiment-classifier-fold-0), [fold 1](https://huggingface.co/w11wo/indonesian-roberta-base-indolem-sentiment-classifier-fold-1), [fold 2](https://huggingface.co/w11wo/indonesian-roberta-base-indolem-sentiment-classifier-fold-2), [fold 3](https://huggingface.co/w11wo/indonesian-roberta-base-indolem-sentiment-classifier-fold-3), and [fold 4](https://huggingface.co/w11wo/indonesian-roberta-base-indolem-sentiment-classifier-fold-4), in their respective links.
17
+
18
+ On **fold 0**, the model achieved an F1 of 86.42% on dev/validation and 83.12% on test. On all **5 folds**, the models achieved an average F1 of 84.14% on dev/validation and 84.64% on test.
19
+
20
+ Hugging Face's `Trainer` class from the [Transformers](https://huggingface.co/transformers) library was used to train the model. PyTorch was used as the backend framework during training, but the model remains compatible with other frameworks nonetheless.
21
+
22
+ ## Model
23
+
24
+ | Model | #params | Arch. | Training/Validation data (text) |
25
+ | ------------------------------------------------------------- | ------- | ------------ | ------------------------------- |
26
+ | `indonesian-roberta-base-indolem-sentiment-classifier-fold-0` | 124M | RoBERTa Base | `IndoLEM`'s Sentiment Analysis |
27
+
28
+ ## Evaluation Results
29
+
30
+ The model was trained for 10 epochs and the best model was loaded at the end.
31
+
32
+ | Epoch | Training Loss | Validation Loss | Accuracy | F1 | Precision | Recall |
33
+ | ----- | ------------- | --------------- | -------- | -------- | --------- | -------- |
34
+ | 1 | 0.563500 | 0.420457 | 0.796992 | 0.626728 | 0.680000 | 0.581197 |
35
+ | 2 | 0.293600 | 0.281360 | 0.884712 | 0.811475 | 0.779528 | 0.846154 |
36
+ | 3 | 0.163000 | 0.267922 | 0.904762 | 0.844262 | 0.811024 | 0.880342 |
37
+ | 4 | 0.090200 | 0.335411 | 0.899749 | 0.838710 | 0.793893 | 0.888889 |
38
+ | 5 | 0.065200 | 0.462526 | 0.897243 | 0.835341 | 0.787879 | 0.888889 |
39
+ | 6 | 0.039200 | 0.423001 | 0.912281 | 0.859438 | 0.810606 | 0.914530 |
40
+ | 7 | 0.025300 | 0.452100 | 0.912281 | 0.859438 | 0.810606 | 0.914530 |
41
+ | 8 | 0.010400 | 0.525200 | 0.914787 | 0.855932 | 0.848739 | 0.863248 |
42
+ | 9 | 0.007100 | 0.513585 | 0.909774 | 0.850000 | 0.829268 | 0.871795 |
43
+ | 10 | 0.007200 | 0.537254 | 0.917293 | 0.864198 | 0.833333 | 0.897436 |
44
+
45
+ ## How to Use
46
+
47
+ ### As Text Classifier
48
+
49
+ ```python
50
+ from transformers import pipeline
51
+
52
+ pretrained_name = "w11wo/indonesian-roberta-base-indolem-sentiment-classifier-fold-0"
53
+
54
+ nlp = pipeline(
55
+ "sentiment-analysis",
56
+ model=pretrained_name,
57
+ tokenizer=pretrained_name
58
+ )
59
+
60
+ nlp("Pelayanan hotel ini sangat baik.")
61
+ ```
62
+
63
+ ## Disclaimer
64
+
65
+ Do consider the biases which come from both the pre-trained RoBERTa model and `IndoLEM`'s Sentiment Analysis dataset that may be carried over into the results of this model.
66
+
67
+ ## Author
68
+
69
+ Indonesian RoBERTa Base IndoLEM Sentiment Classifier was trained and evaluated by [Wilson Wongso](https://w11wo.github.io/). All computation and development are done on Google Colaboratory using their free GPU access.
config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "flax-community/indonesian-roberta-base",
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
+ "initializer_range": 0.02,
15
+ "intermediate_size": 3072,
16
+ "layer_norm_eps": 1e-05,
17
+ "max_position_embeddings": 514,
18
+ "model_type": "roberta",
19
+ "num_attention_heads": 12,
20
+ "num_hidden_layers": 12,
21
+ "pad_token_id": 1,
22
+ "position_embedding_type": "absolute",
23
+ "problem_type": "single_label_classification",
24
+ "torch_dtype": "float32",
25
+ "transformers_version": "4.11.2",
26
+ "type_vocab_size": 1,
27
+ "use_cache": true,
28
+ "vocab_size": 50265
29
+ }
gitattributes ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.model filter=lfs diff=lfs merge=lfs -text
12
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
13
+ *.onnx filter=lfs diff=lfs merge=lfs -text
14
+ *.ot filter=lfs diff=lfs merge=lfs -text
15
+ *.parquet filter=lfs diff=lfs merge=lfs -text
16
+ *.pb filter=lfs diff=lfs merge=lfs -text
17
+ *.pt filter=lfs diff=lfs merge=lfs -text
18
+ *.pth filter=lfs diff=lfs merge=lfs -text
19
+ *.rar filter=lfs diff=lfs merge=lfs -text
20
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
21
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
22
+ *.tflite filter=lfs diff=lfs merge=lfs -text
23
+ *.tgz 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
28
+ model.safetensors filter=lfs diff=lfs merge=lfs -text
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ff436956548e288d57a2f7e2c8191adfdc7a717cb42068d5fea3336974ad0be3
3
+ size 498617024
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3aead81fbdb4611873df5ec497ac2f853236d2743e3192b6c302440625bdd87c
3
+ size 498674093
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": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": false}}
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"unk_token": "<unk>", "bos_token": "<s>", "eos_token": "</s>", "add_prefix_space": false, "errors": "replace", "sep_token": "</s>", "cls_token": "<s>", "pad_token": "<pad>", "mask_token": "<mask>", "special_tokens_map_file": null, "name_or_path": "flax-community/indonesian-roberta-base", "tokenizer_class": "RobertaTokenizer"}
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0faa92bd7ed077549742faac2919a8b42ffcfcc5b5defc66435cdacb4c7b56ef
3
+ size 2799
vocab.json ADDED
The diff for this file is too large to render. See raw diff