mainguyen9 commited on
Commit
07b49e0
·
verified ·
1 Parent(s): cf7af75

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - vi
4
+ license: mit
5
+ tags:
6
+ - bert
7
+ - roberta
8
+ - vietnamese
9
+ - fill-mask
10
+ - feature-extraction
11
+ datasets:
12
+ - cc100
13
+ pipeline_tag: fill-mask
14
+ model-index:
15
+ - name: viBERT-base
16
+ results:
17
+ - task:
18
+ type: token-classification
19
+ name: Named Entity Recognition
20
+ dataset:
21
+ name: PhoNER_COVID19
22
+ type: VinAIResearch/PhoNER_COVID19
23
+ metrics:
24
+ - type: f1
25
+ value: 89.38
26
+ name: F1 (micro)
27
+ ---
28
+
29
+ # viBERT-base
30
+
31
+ A Vietnamese RoBERTa-based language model pre-trained on CC-100 Vietnamese and custom Vietnamese corpus.
32
+
33
+ ## Model Description
34
+
35
+ **viBERT-base** is a BERT-base architecture model trained with RoBERTa-style pre-training on Vietnamese text data. It can be used for various Vietnamese NLP downstream tasks such as Named Entity Recognition, Text Classification, Question Answering, and more.
36
+
37
+ ### Model Architecture
38
+
39
+ | Parameter | Value |
40
+ |-----------|-------|
41
+ | Architecture | BERT-base |
42
+ | Hidden size | 768 |
43
+ | Attention heads | 12 |
44
+ | Hidden layers | 12 |
45
+ | Vocab size | 41,035 |
46
+ | Max sequence length | 512 |
47
+ | Parameters | ~110M |
48
+
49
+ ## Training Data
50
+
51
+ - **CC-100 Vietnamese**: Large-scale web crawl data
52
+ - **Custom Vietnamese corpus**: Additional curated Vietnamese text
53
+
54
+ ## Usage
55
+
56
+ ### Feature Extraction
57
+
58
+ ```python
59
+ from transformers import AutoModel, AutoTokenizer
60
+
61
+ # Load model and tokenizer
62
+ tokenizer = AutoTokenizer.from_pretrained("mainguyen9/viBERT-base")
63
+ model = AutoModel.from_pretrained("mainguyen9/viBERT-base")
64
+
65
+ # Encode text
66
+ text = "Xin chào Việt Nam"
67
+ inputs = tokenizer(text, return_tensors="pt")
68
+ outputs = model(**inputs)
69
+
70
+ # Get embeddings
71
+ last_hidden_state = outputs.last_hidden_state
72
+ ```
73
+
74
+ ### Masked Language Modeling
75
+
76
+ ```python
77
+ from transformers import pipeline
78
+
79
+ fill_mask = pipeline("fill-mask", model="mainguyen9/viBERT-base")
80
+ result = fill_mask("Hà Nội là [MASK] đô của Việt Nam.")
81
+ print(result)
82
+ ```
83
+
84
+ ### Fine-tuning for NER
85
+
86
+ ```python
87
+ from transformers import AutoModelForTokenClassification, AutoTokenizer
88
+
89
+ model = AutoModelForTokenClassification.from_pretrained(
90
+ "mainguyen9/viBERT-base",
91
+ num_labels=num_labels
92
+ )
93
+ tokenizer = AutoTokenizer.from_pretrained("mainguyen9/viBERT-base")
94
+ ```
95
+
96
+ ## Benchmark Results
97
+
98
+ | Task | Dataset | Metric | Score |
99
+ |------|---------|--------|-------|
100
+ | NER | PhoNER_COVID19 | F1 | **89.38** |
101
+
102
+ ### NER Performance Details (PhoNER_COVID19)
103
+
104
+ Fine-tuned with 5 epochs, batch size 32, learning rate 2e-5.
105
+
106
+ | Entity Type | Precision | Recall | F1-Score | Support |
107
+ |-------------|-----------|--------|----------|---------|
108
+ | AGE | 90.91 | 97.27 | 93.98 | 586 |
109
+ | DATE | 98.20 | 99.17 | 98.68 | 3,026 |
110
+ | GENDER | 89.96 | 92.23 | 91.08 | 476 |
111
+ | JOB | 66.59 | 51.75 | 58.24 | 570 |
112
+ | LOCATION | 88.52 | 91.33 | 89.90 | 10,845 |
113
+ | NAME | 94.09 | 90.56 | 92.29 | 1,388 |
114
+ | ORGANIZATION | 77.02 | 78.05 | 77.53 | 1,640 |
115
+ | PATIENT_ID | 95.61 | 98.54 | 97.05 | 2,120 |
116
+ | SYMPTOM_AND_DISEASE | 82.84 | 74.70 | 78.56 | 2,158 |
117
+ | TRANSPORTATION | 85.63 | 91.41 | 88.43 | 489 |
118
+ | **Micro Average** | **89.09** | **89.69** | **89.38** | **23,298** |
119
+
120
+ ## Limitations
121
+
122
+ - Primarily trained on Vietnamese text; performance may vary for code-mixed text
123
+ - 512 token maximum sequence length
124
+
125
+ ## Citation
126
+
127
+ ```bibtex
128
+ @misc{vibert-base,
129
+ author = {Mai Nguyen},
130
+ title = {viBERT-base: A Vietnamese RoBERTa Model},
131
+ year = {2024},
132
+ publisher = {Hugging Face},
133
+ url = {https://huggingface.co/mainguyen9/viBERT-base}
134
+ }
135
+ ```
136
+
137
+ ## License
138
+
139
+ MIT License
config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_cross_attention": false,
3
+ "architectures": [
4
+ "BertModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": null,
8
+ "classifier_dropout": null,
9
+ "dtype": "float32",
10
+ "eos_token_id": null,
11
+ "gradient_checkpointing": false,
12
+ "hidden_act": "gelu",
13
+ "hidden_dropout_prob": 0.1,
14
+ "hidden_size": 768,
15
+ "initializer_range": 0.02,
16
+ "intermediate_size": 3072,
17
+ "is_decoder": false,
18
+ "layer_norm_eps": 1e-12,
19
+ "max_position_embeddings": 512,
20
+ "model_type": "bert",
21
+ "num_attention_heads": 12,
22
+ "num_hidden_layers": 12,
23
+ "pad_token_id": 0,
24
+ "position_embedding_type": "absolute",
25
+ "tie_word_embeddings": true,
26
+ "transformers_version": "5.3.0",
27
+ "type_vocab_size": 2,
28
+ "use_cache": true,
29
+ "vocab_size": 41035
30
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3479edd7b96e3a081918b04005163d02c638720450d38a34970fcbdeffad0dc5
3
+ size 470247248
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:51d97adbfa1cb0a84bbde0e1dffca6a86cf13093a917f90bc287cd46b501eaad
3
+ size 470466795
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "do_lower_case": true,
4
+ "mask_token": "[MASK]",
5
+ "name_or_path": "/home/hieu.tran5/models/moberta_mlm_base",
6
+ "pad_token": "[PAD]",
7
+ "sep_token": "[SEP]",
8
+ "special_tokens_map_file": "/home/hieu.tran5/models/moberta_mlm_base/special_tokens_map.json",
9
+ "strip_accents": null,
10
+ "tokenize_chinese_chars": true,
11
+ "tokenizer_class": "BertTokenizer",
12
+ "unk_token": "[UNK]"
13
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff