Commit from model create scripts
Browse files- .gitattributes +1 -0
- config.gin +178 -0
- config.json +29 -0
- flax_model.msgpack +3 -0
- model-info.txt +0 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- spiece.model +3 -0
- tokenizer_config.json +1 -0
- train/events.out.tfevents.1652376058.t1v-n-569e1ce4-w-0.282691.0.v2 +3 -0
- training_eval/deuncaser/events.out.tfevents.1652376059.t1v-n-569e1ce4-w-0.282691.1.v2 +3 -0
.gitattributes
CHANGED
@@ -25,3 +25,4 @@ saved_model/**/* 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
|
|
|
|
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 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
config.gin
ADDED
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from __gin__ import dynamic_registration
|
2 |
+
import __main__ as train_script
|
3 |
+
import seqio
|
4 |
+
from t5.data import mixtures
|
5 |
+
from t5x import adafactor
|
6 |
+
from t5x.examples.t5 import network
|
7 |
+
from t5x import gin_utils
|
8 |
+
from t5x import models
|
9 |
+
from t5x import partitioning
|
10 |
+
from t5x import trainer
|
11 |
+
from t5x import utils
|
12 |
+
import tasks
|
13 |
+
|
14 |
+
# Macros:
|
15 |
+
# ==============================================================================
|
16 |
+
BATCH_SIZE = 128
|
17 |
+
DROPOUT_RATE = 0.1
|
18 |
+
EVAL_STEPS = 20
|
19 |
+
EVALUATOR_NUM_EXAMPLES = None
|
20 |
+
EVALUATOR_USE_MEMORY_CACHE = True
|
21 |
+
INITIAL_CHECKPOINT_PATH = \
|
22 |
+
'gs://north-t5x/pretrained_models/base/norwegian_NCC_plus_English_pluss200k_balanced_bokmaal_nynorsk_t5x_base/checkpoint_1700000'
|
23 |
+
JSON_WRITE_N_RESULTS = None
|
24 |
+
LABEL_SMOOTHING = 0.0
|
25 |
+
LOSS_NORMALIZING_FACTOR = None
|
26 |
+
MIXTURE_OR_TASK_MODULE = None
|
27 |
+
MIXTURE_OR_TASK_NAME = 'deuncaser'
|
28 |
+
MODEL = @models.EncoderDecoderModel()
|
29 |
+
MODEL_DIR = 'gs://north-t5x/finetuned/deuncaser/deuncaser_base_v1'
|
30 |
+
OPTIMIZER = @adafactor.Adafactor()
|
31 |
+
RANDOM_SEED = 0
|
32 |
+
TASK_FEATURE_LENGTHS = {'inputs': 512, 'targets': 512}
|
33 |
+
TRAIN_STEPS = 1800000
|
34 |
+
USE_CACHED_TASKS = False
|
35 |
+
USE_HARDWARE_RNG = False
|
36 |
+
VOCABULARY = @seqio.SentencePieceVocabulary()
|
37 |
+
Z_LOSS = 0.0001
|
38 |
+
|
39 |
+
# Parameters for adafactor.Adafactor:
|
40 |
+
# ==============================================================================
|
41 |
+
adafactor.Adafactor.decay_rate = 0.8
|
42 |
+
adafactor.Adafactor.logical_factor_rules = \
|
43 |
+
@adafactor.standard_logical_factor_rules()
|
44 |
+
adafactor.Adafactor.step_offset = 0
|
45 |
+
|
46 |
+
# Parameters for utils.CheckpointConfig:
|
47 |
+
# ==============================================================================
|
48 |
+
utils.CheckpointConfig.restore = @utils.RestoreCheckpointConfig()
|
49 |
+
utils.CheckpointConfig.save = @utils.SaveCheckpointConfig()
|
50 |
+
|
51 |
+
# Parameters for utils.create_learning_rate_scheduler:
|
52 |
+
# ==============================================================================
|
53 |
+
utils.create_learning_rate_scheduler.base_learning_rate = 0.001
|
54 |
+
utils.create_learning_rate_scheduler.factors = 'constant'
|
55 |
+
utils.create_learning_rate_scheduler.warmup_steps = 1000
|
56 |
+
|
57 |
+
# Parameters for infer_eval/utils.DatasetConfig:
|
58 |
+
# ==============================================================================
|
59 |
+
infer_eval/utils.DatasetConfig.batch_size = %BATCH_SIZE
|
60 |
+
infer_eval/utils.DatasetConfig.mixture_or_task_name = %MIXTURE_OR_TASK_NAME
|
61 |
+
infer_eval/utils.DatasetConfig.module = %MIXTURE_OR_TASK_MODULE
|
62 |
+
infer_eval/utils.DatasetConfig.pack = False
|
63 |
+
infer_eval/utils.DatasetConfig.seed = 42
|
64 |
+
infer_eval/utils.DatasetConfig.shuffle = False
|
65 |
+
infer_eval/utils.DatasetConfig.split = 'validation'
|
66 |
+
infer_eval/utils.DatasetConfig.task_feature_lengths = %TASK_FEATURE_LENGTHS
|
67 |
+
infer_eval/utils.DatasetConfig.use_cached = %USE_CACHED_TASKS
|
68 |
+
|
69 |
+
# Parameters for train/utils.DatasetConfig:
|
70 |
+
# ==============================================================================
|
71 |
+
train/utils.DatasetConfig.batch_size = %BATCH_SIZE
|
72 |
+
train/utils.DatasetConfig.mixture_or_task_name = %MIXTURE_OR_TASK_NAME
|
73 |
+
train/utils.DatasetConfig.module = %MIXTURE_OR_TASK_MODULE
|
74 |
+
train/utils.DatasetConfig.pack = True
|
75 |
+
train/utils.DatasetConfig.seed = None
|
76 |
+
train/utils.DatasetConfig.shuffle = True
|
77 |
+
train/utils.DatasetConfig.split = 'train'
|
78 |
+
train/utils.DatasetConfig.task_feature_lengths = %TASK_FEATURE_LENGTHS
|
79 |
+
train/utils.DatasetConfig.use_cached = %USE_CACHED_TASKS
|
80 |
+
|
81 |
+
# Parameters for train_eval/utils.DatasetConfig:
|
82 |
+
# ==============================================================================
|
83 |
+
train_eval/utils.DatasetConfig.batch_size = %BATCH_SIZE
|
84 |
+
train_eval/utils.DatasetConfig.mixture_or_task_name = %MIXTURE_OR_TASK_NAME
|
85 |
+
train_eval/utils.DatasetConfig.module = %MIXTURE_OR_TASK_MODULE
|
86 |
+
train_eval/utils.DatasetConfig.pack = True
|
87 |
+
train_eval/utils.DatasetConfig.seed = 42
|
88 |
+
train_eval/utils.DatasetConfig.shuffle = False
|
89 |
+
train_eval/utils.DatasetConfig.split = 'validation'
|
90 |
+
train_eval/utils.DatasetConfig.task_feature_lengths = %TASK_FEATURE_LENGTHS
|
91 |
+
train_eval/utils.DatasetConfig.use_cached = %USE_CACHED_TASKS
|
92 |
+
|
93 |
+
# Parameters for models.EncoderDecoderModel:
|
94 |
+
# ==============================================================================
|
95 |
+
models.EncoderDecoderModel.input_vocabulary = %VOCABULARY
|
96 |
+
models.EncoderDecoderModel.label_smoothing = %LABEL_SMOOTHING
|
97 |
+
models.EncoderDecoderModel.loss_normalizing_factor = %LOSS_NORMALIZING_FACTOR
|
98 |
+
models.EncoderDecoderModel.module = @network.Transformer()
|
99 |
+
models.EncoderDecoderModel.optimizer_def = %OPTIMIZER
|
100 |
+
models.EncoderDecoderModel.output_vocabulary = %VOCABULARY
|
101 |
+
models.EncoderDecoderModel.z_loss = %Z_LOSS
|
102 |
+
|
103 |
+
# Parameters for seqio.Evaluator:
|
104 |
+
# ==============================================================================
|
105 |
+
seqio.Evaluator.logger_cls = \
|
106 |
+
[@seqio.PyLoggingLogger, @seqio.TensorBoardLogger, @seqio.JSONLogger]
|
107 |
+
seqio.Evaluator.num_examples = %EVALUATOR_NUM_EXAMPLES
|
108 |
+
seqio.Evaluator.use_memory_cache = %EVALUATOR_USE_MEMORY_CACHE
|
109 |
+
|
110 |
+
# Parameters for seqio.JSONLogger:
|
111 |
+
# ==============================================================================
|
112 |
+
seqio.JSONLogger.write_n_results = %JSON_WRITE_N_RESULTS
|
113 |
+
|
114 |
+
# Parameters for partitioning.PjitPartitioner:
|
115 |
+
# ==============================================================================
|
116 |
+
partitioning.PjitPartitioner.logical_axis_rules = \
|
117 |
+
@partitioning.standard_logical_axis_rules()
|
118 |
+
partitioning.PjitPartitioner.model_parallel_submesh = None
|
119 |
+
partitioning.PjitPartitioner.num_partitions = 1
|
120 |
+
|
121 |
+
# Parameters for utils.RestoreCheckpointConfig:
|
122 |
+
# ==============================================================================
|
123 |
+
utils.RestoreCheckpointConfig.dtype = 'float32'
|
124 |
+
utils.RestoreCheckpointConfig.mode = 'specific'
|
125 |
+
utils.RestoreCheckpointConfig.path = %INITIAL_CHECKPOINT_PATH
|
126 |
+
|
127 |
+
# Parameters for utils.SaveCheckpointConfig:
|
128 |
+
# ==============================================================================
|
129 |
+
utils.SaveCheckpointConfig.dtype = 'float32'
|
130 |
+
utils.SaveCheckpointConfig.keep = None
|
131 |
+
utils.SaveCheckpointConfig.period = 10000
|
132 |
+
utils.SaveCheckpointConfig.save_dataset = False
|
133 |
+
|
134 |
+
# Parameters for seqio.SentencePieceVocabulary:
|
135 |
+
# ==============================================================================
|
136 |
+
seqio.SentencePieceVocabulary.sentencepiece_model_file = \
|
137 |
+
'gs://t5-data/vocabs/mc4.250000.100extra/sentencepiece.model'
|
138 |
+
|
139 |
+
# Parameters for network.T5Config:
|
140 |
+
# ==============================================================================
|
141 |
+
network.T5Config.dropout_rate = %DROPOUT_RATE
|
142 |
+
network.T5Config.dtype = 'bfloat16'
|
143 |
+
network.T5Config.emb_dim = 768
|
144 |
+
network.T5Config.head_dim = 64
|
145 |
+
network.T5Config.logits_via_embedding = False
|
146 |
+
network.T5Config.mlp_activations = ('gelu', 'linear')
|
147 |
+
network.T5Config.mlp_dim = 2048
|
148 |
+
network.T5Config.num_decoder_layers = 12
|
149 |
+
network.T5Config.num_encoder_layers = 12
|
150 |
+
network.T5Config.num_heads = 12
|
151 |
+
network.T5Config.vocab_size = 250112
|
152 |
+
|
153 |
+
# Parameters for train_script.train:
|
154 |
+
# ==============================================================================
|
155 |
+
train_script.train.checkpoint_cfg = @utils.CheckpointConfig()
|
156 |
+
train_script.train.eval_period = 1000
|
157 |
+
train_script.train.eval_steps = %EVAL_STEPS
|
158 |
+
train_script.train.infer_eval_dataset_cfg = @infer_eval/utils.DatasetConfig()
|
159 |
+
train_script.train.inference_evaluator_cls = @seqio.Evaluator
|
160 |
+
train_script.train.model = %MODEL
|
161 |
+
train_script.train.model_dir = %MODEL_DIR
|
162 |
+
train_script.train.partitioner = @partitioning.PjitPartitioner()
|
163 |
+
train_script.train.random_seed = %RANDOM_SEED
|
164 |
+
train_script.train.summarize_config_fn = @gin_utils.summarize_gin_config
|
165 |
+
train_script.train.total_steps = %TRAIN_STEPS
|
166 |
+
train_script.train.train_dataset_cfg = @train/utils.DatasetConfig()
|
167 |
+
train_script.train.train_eval_dataset_cfg = @train_eval/utils.DatasetConfig()
|
168 |
+
train_script.train.trainer_cls = @trainer.Trainer
|
169 |
+
train_script.train.use_hardware_rng = %USE_HARDWARE_RNG
|
170 |
+
|
171 |
+
# Parameters for trainer.Trainer:
|
172 |
+
# ==============================================================================
|
173 |
+
trainer.Trainer.learning_rate_fn = @utils.create_learning_rate_scheduler()
|
174 |
+
trainer.Trainer.num_microbatches = None
|
175 |
+
|
176 |
+
# Parameters for network.Transformer:
|
177 |
+
# ==============================================================================
|
178 |
+
network.Transformer.config = @network.T5Config()
|
config.json
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "/home/perk/models/demo-deuncaser-base",
|
3 |
+
"architectures": [
|
4 |
+
"T5ForConditionalGeneration"
|
5 |
+
],
|
6 |
+
"d_ff": 2048,
|
7 |
+
"d_kv": 64,
|
8 |
+
"d_model": 768,
|
9 |
+
"decoder_start_token_id": 0,
|
10 |
+
"dropout_rate": 0.1,
|
11 |
+
"eos_token_id": 1,
|
12 |
+
"feed_forward_proj": "gated-gelu",
|
13 |
+
"initializer_factor": 1.0,
|
14 |
+
"is_encoder_decoder": true,
|
15 |
+
"layer_norm_epsilon": 1e-06,
|
16 |
+
"model_type": "t5",
|
17 |
+
"num_decoder_layers": 12,
|
18 |
+
"num_heads": 12,
|
19 |
+
"num_layers": 12,
|
20 |
+
"output_past": true,
|
21 |
+
"pad_token_id": 0,
|
22 |
+
"relative_attention_num_buckets": 32,
|
23 |
+
"tie_word_embeddings": false,
|
24 |
+
"tokenizer_class": "T5Tokenizer",
|
25 |
+
"torch_dtype": "float32",
|
26 |
+
"transformers_version": "4.17.0",
|
27 |
+
"use_cache": true,
|
28 |
+
"vocab_size": 250112
|
29 |
+
}
|
flax_model.msgpack
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:06e968385c0d1dbade8052c51335df6313da39a0cf18731f44d85eb8a818a586
|
3 |
+
size 2329617315
|
model-info.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d4cb6890a66404d755091d559221ca11ee52e47c67f3674ea6159b068ac3e550
|
3 |
+
size 2329729805
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"eos_token": "</s>", "unk_token": "<unk>", "pad_token": "<pad>"}
|
spiece.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ef78f86560d809067d12bac6c09f19a462cb3af3f54d2b8acbba26e1433125d6
|
3 |
+
size 4309802
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"eos_token": "</s>", "unk_token": "<unk>", "pad_token": "<pad>", "extra_ids": 0, "additional_special_tokens": null, "special_tokens_map_file": "/home/patrick/.cache/torch/transformers/685ac0ca8568ec593a48b61b0a3c272beee9bc194a3c7241d15dcadb5f875e53.f76030f3ec1b96a8199b2593390c610e76ca8028ef3d24680000619ffb646276", "tokenizer_file": null, "name_or_path": "google/mt5-small"}
|
train/events.out.tfevents.1652376058.t1v-n-569e1ce4-w-0.282691.0.v2
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:030b518e38f79fbd8d84f3130df6032b09f2e27217e5d6a1499402bbc92a7fe0
|
3 |
+
size 162654
|
training_eval/deuncaser/events.out.tfevents.1652376059.t1v-n-569e1ce4-w-0.282691.1.v2
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f0d3c56cc25321f3912cd2b2424944a50964e95efcf3f0ffd3165e0b467d3a17
|
3 |
+
size 130626
|