bayartsogt
commited on
Commit
•
84b5b20
1
Parent(s):
9ba7f5e
Saving weights and logs of epoch 1
Browse files- .gitattributes +1 -0
- config.json +25 -0
- events.out.tfevents.1625460253.t1v-n-ca847b55-w-0.223752.3.v2 +3 -0
- flax_model.msgpack +3 -0
- run_config.py +7 -0
- run_mlm_flax.py +1 -0
- run_tokenizer.py +26 -0
- tokenizer.json +0 -0
- train_mlm.sh +19 -0
.gitattributes
CHANGED
@@ -14,3 +14,4 @@
|
|
14 |
*.pb filter=lfs diff=lfs merge=lfs -text
|
15 |
*.pt filter=lfs diff=lfs merge=lfs -text
|
16 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
|
|
|
14 |
*.pb filter=lfs diff=lfs merge=lfs -text
|
15 |
*.pt filter=lfs diff=lfs merge=lfs -text
|
16 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
config.json
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"RobertaForMaskedLM"
|
4 |
+
],
|
5 |
+
"attention_probs_dropout_prob": 0.1,
|
6 |
+
"bos_token_id": 0,
|
7 |
+
"eos_token_id": 2,
|
8 |
+
"gradient_checkpointing": false,
|
9 |
+
"hidden_act": "gelu",
|
10 |
+
"hidden_dropout_prob": 0.1,
|
11 |
+
"hidden_size": 768,
|
12 |
+
"initializer_range": 0.02,
|
13 |
+
"intermediate_size": 3072,
|
14 |
+
"layer_norm_eps": 1e-05,
|
15 |
+
"max_position_embeddings": 514,
|
16 |
+
"model_type": "roberta",
|
17 |
+
"num_attention_heads": 12,
|
18 |
+
"num_hidden_layers": 12,
|
19 |
+
"pad_token_id": 1,
|
20 |
+
"position_embedding_type": "absolute",
|
21 |
+
"transformers_version": "4.9.0.dev0",
|
22 |
+
"type_vocab_size": 1,
|
23 |
+
"use_cache": true,
|
24 |
+
"vocab_size": 50265
|
25 |
+
}
|
events.out.tfevents.1625460253.t1v-n-ca847b55-w-0.223752.3.v2
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b14592f3d5c033ef71f8f184590d5601c7fb34ae48fd9ae2a42c146d6062b6a7
|
3 |
+
size 110080
|
flax_model.msgpack
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1492e9fabddf37e34be75ab81414b608e6e56ed031572e9b58b35baf1b9514a4
|
3 |
+
size 498796983
|
run_config.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import RobertaConfig
|
2 |
+
|
3 |
+
model_dir = "./" # ${MODEL_DIR}
|
4 |
+
|
5 |
+
config = RobertaConfig.from_pretrained("roberta-base")
|
6 |
+
config.save_pretrained(model_dir)
|
7 |
+
|
run_mlm_flax.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
/home/bayartsogtyadamsuren/transformers/examples/flax/language-modeling/run_mlm_flax.py
|
run_tokenizer.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from datasets import load_dataset
|
2 |
+
from tokenizers import trainers, Tokenizer, normalizers, ByteLevelBPETokenizer
|
3 |
+
|
4 |
+
model_dir = "./" # ${MODEL_DIR}
|
5 |
+
|
6 |
+
# load dataset
|
7 |
+
dataset = load_dataset("oscar", "unshuffled_deduplicated_mn", split="train")
|
8 |
+
|
9 |
+
# Instantiate tokenizer
|
10 |
+
tokenizer = ByteLevelBPETokenizer()
|
11 |
+
|
12 |
+
def batch_iterator(batch_size=1000):
|
13 |
+
for i in range(0, len(dataset), batch_size):
|
14 |
+
yield dataset[i: i + batch_size]["text"]
|
15 |
+
|
16 |
+
# Customized training
|
17 |
+
tokenizer.train_from_iterator(batch_iterator(), vocab_size=50265, min_frequency=2, special_tokens=[
|
18 |
+
"<s>",
|
19 |
+
"<pad>",
|
20 |
+
"</s>",
|
21 |
+
"<unk>",
|
22 |
+
"<mask>",
|
23 |
+
])
|
24 |
+
|
25 |
+
# Save files to disk
|
26 |
+
tokenizer.save(f"{model_dir}/tokenizer.json")
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
train_mlm.sh
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
./run_mlm_flax.py \
|
2 |
+
--output_dir="${MODEL_DIR}" \
|
3 |
+
--model_type="roberta" \
|
4 |
+
--config_name="${MODEL_DIR}" \
|
5 |
+
--tokenizer_name="${MODEL_DIR}" \
|
6 |
+
--dataset_name="oscar" \
|
7 |
+
--dataset_config_name="unshuffled_deduplicated_mn" \
|
8 |
+
--max_seq_length="128" \
|
9 |
+
--weight_decay="0.01" \
|
10 |
+
--per_device_train_batch_size="128" \
|
11 |
+
--per_device_eval_batch_size="128" \
|
12 |
+
--learning_rate="3e-4" \
|
13 |
+
--warmup_steps="1000" \
|
14 |
+
--overwrite_output_dir \
|
15 |
+
--pad_to_max_length \
|
16 |
+
--num_train_epochs="18" \
|
17 |
+
--adam_beta1="0.9" \
|
18 |
+
--adam_beta2="0.98" \
|
19 |
+
--push_to_hub
|