-
Notifications
You must be signed in to change notification settings - Fork 2
/
project.yml
300 lines (262 loc) · 11.3 KB
/
project.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
title: "Training pipeline for Ancient Greek Language Model"
description: >
Reproducible workflows for training the ancient greek spaCy pipeline.
vars:
lang: "grc"
# base models (dependencies)
# Currently these are the ones on Huggingface
base_model:
config_trf: "transformer"
config_sm: "sm"
model_name_sm: "grc_odycy_joint_sm"
model_name_trf: "grc_odycy_joint_trf"
package_name_sm: "odycy_joint_sm" # TODO workaround
package_name_trf: "odycy_joint_trf" # TODO workaround
training_corpus: "joint"
package_version: "0.7.0"
# ner models (models with dep+ner)
ner_model:
config_trf: "transformer_ner-v3.5"
config_sm: "sm_ner-v3.5"
model_name_sm: "grc_ner_joint_sm"
model_name_trf: "grc_ner_joint_trf"
package_name_sm: "ner_joint_sm" # TODO workaround
package_name_trf: "ner_joint_trf" # TODO workaround
training_corpus: "ner"
package_version: "0.0.1"
# experimental models
exp_models:
config_trf: "transformer"
config_xlm: "transformer_multilingual-v3.5"
model_name_trf_proiel: "grc_exp_proiel_trf"
model_name_trf_perseus: "grc_exp_perseus_trf"
model_name_xlm_base: "grc_exp_joint_xlm"
model_name_xlm_proiel: "grc_exp_proiel_xlm"
model_name_xlm_perseus: "grc_exp_perseus_xlm"
package_version: "0.0.0"
# misc
gpu: 0
spacy_version: ">=3.7.0"
directories: ["assets", "corpus", "training", "scripts"]
workflows:
preprocess:
- install
- fetch_assets
- prepare
- get_homercy_checkpoints
train_evaluate_sm_base:
- train_sm_base
- evaluate_sm_base
train_evaluate_trf_base:
- train_trf_base
- evaluate_trf_base
train_evaluate_sm_ner:
- train_sm_ner
- evaluate_sm_ner
train_evaluate_trf_ner:
- train_trf_ner
- evaluate_trf_ner
all_sm_base:
- install
- fetch_assets
- prepare
- train_sm_base
- evaluate_sm_base
- package_sm_base
all_trf_base:
- install
- fetch_assets
- prepare
- train_trf_base
- evaluate_trf_base
- package_trf_base
all_sm_ner:
- install
- fetch_assets
- prepare
- get_homercy_checkpoints
- train_sm_ner
- evaluate_sm_ner
- package_sm_ner
- push_sm_ner
all_trf_ner:
- install
- fetch_assets
- prepare
- get_homercy_checkpoints
- train_trf_ner
- evaluate_trf_ner
- package_trf_ner
- push_trf_ner
hub_models:
- get_homercy_checkpoints
- evaluate_hub
- evaluate_jacobo
exp_trf_separate:
- train_trf_separate
- evaluate_trf_separate
- package_trf_separate
exp_xlm_base:
- train_xlm_base
- evaluate_xlm_base
- package_xlm_base
exp_xlm_separate:
- train_xlm_separate
- evaluate_xlm_separate
- package_xlm_separate
commands:
# Installation
- name: install
help: "Creating environments and installing dependencies"
script:
# - "bash scripts/dependencies/server_dependencies.sh"
- "bash scripts/dependencies/create_environments.sh"
deps:
- "requirements_preprocessing.txt"
- "requirements_training.txt"
- "requirements_packaging.txt"
# Fetching assets
- name: fetch_assets
help: Fetches treebanks, pretraining corpus and named entity assets.
script:
- "bash scripts/fetch/fetch_treebanks.sh"
- "bash scripts/clean/clean_treebanks.sh"
- "bash scripts/fetch/fetch_pretraining.sh"
- "bash scripts/clean/clean_pretraining.sh"
- "bash scripts/fetch/fetch_named_entities.sh"
- "bash scripts/clean/clean_named_entities.sh"
- "bash scripts/fetch/fetch_lemma_lookup.sh"
# donwload models we've already trained
- name: get_homercy_checkpoints
help: Downloads pretrained HomerCy models from huggingface hub
script:
- "bash scripts/dependencies/get_homercy_checkpoints.sh"
# Preprocessing assets for training
- name: prepare
help: "Prepares assets for training"
script:
- "bash scripts/prepare.sh"
# Training scripts
- name: train_sm_base
help: "Trains a sm model over the dataset"
script:
- "bash scripts/train.sh ${vars.base_model.config_sm} ${vars.base_model.model_name_sm} ${vars.base_model.training_corpus} cpu"
- name: train_trf_base
help: "Finetunes the Bert based transformer model on the treebanks"
script:
- "bash scripts/train.sh ${vars.base_model.config_trf} ${vars.base_model.model_name_trf} ${vars.base_model.training_corpus} gpu"
- name: train_sm_ner
help: "Trains an extra NER component using the base small model"
script:
- "bash scripts/train.sh ${vars.ner_model.config_sm} ${vars.ner_model.model_name_sm} ${vars.ner_model.training_corpus} cpu"
- name: train_trf_ner
help: "Trains an extra NER component using the base transformer model"
script:
- "bash scripts/train.sh ${vars.ner_model.config_trf} ${vars.ner_model.model_name_trf} ${vars.ner_model.training_corpus} gpu"
- name: train_xlm_base
script:
- "bash scripts/train.sh ${vars.exp_models.config_xlm} ${vars.exp_models.model_name_xlm_base} ${vars.base_model.training_corpus} gpu"
- name: train_trf_separate
script:
- "bash scripts/train.sh ${vars.exp_models.config_trf} ${vars.exp_models.model_name_trf_proiel} proiel gpu"
- "bash scripts/train.sh ${vars.exp_models.config_trf} ${vars.exp_models.model_name_trf_perseus} perseus gpu"
- name: train_xlm_separate
script:
- "bash scripts/train.sh ${vars.exp_models.config_xlm} ${vars.exp_models.model_name_xlm_proiel} proiel gpu"
- "bash scripts/train.sh ${vars.exp_models.config_xlm} ${vars.exp_models.model_name_xlm_perseus} perseus gpu"
# Evaluation scripts
- name: evaluate_sm_base
help: "Evaluate the sm base model on test data & save the metrics"
script:
- "bash scripts/evaluate/evaluate_trained.sh ${vars.base_model.model_name_sm} ${vars.base_model.package_version}"
- name: evaluate_trf_base
help: "Evaluate the Bert based transformer model on test data & save the metrics"
script:
- "bash scripts/evaluate/evaluate_trained.sh ${vars.base_model.model_name_trf} ${vars.base_model.package_version}"
- name: evaluate_sm_ner
help: "Evaluate the sm ner model & save the metrics"
script:
- "bash scripts/evaluate/evaluate_trained.sh ${vars.ner_model.model_name_sm} ${vars.ner_model.package_version}"
- name: evaluate_trf_ner
help: "Evaluate the transformer ner model & save the metrics"
script:
- "bash scripts/evaluate/evaluate_trained.sh ${vars.ner_model.model_name_trf} ${vars.ner_model.package_version}"
- name: evaluate_hub
help: "Evaluate all HomerCy models that are on the Huggingface Hub"
script:
- "bash scripts/evaluate/evaluate_homercy_checkpoints.sh ${vars.ner_model.model_name_trf} ${vars.ner_model.package_version}"
- name: evaluate_jacobo
help: "Evaluate grc spacy models by others"
script:
- "bash scripts/evaluate/evaluate_jacobo.sh"
- name: evaluate_trf_separate
script:
- "bash scripts/evaluate/evaluate_trained.sh ${vars.exp_models.model_name_trf_proiel} ${vars.exp_models.package_version}"
- "bash scripts/evaluate/evaluate_trained.sh ${vars.exp_models.model_name_trf_perseus} ${vars.exp_models.package_version}"
- name: evaluate_xlm_base
script:
- "bash scripts/evaluate/evaluate_trained.sh ${vars.exp_models.model_name_xlm_base} ${vars.exp_models.package_version}"
- name: evaluate_xlm_separate
script:
- "bash scripts/evaluate/evaluate_trained.sh ${vars.exp_models.model_name_xlm_proiel} ${vars.exp_models.package_version}"
- "bash scripts/evaluate/evaluate_trained.sh ${vars.exp_models.model_name_xlm_perseus} ${vars.exp_models.package_version}"
- name: evaluate_lemmatizers
help: "Evaluate homercy with different lemmatizers."
script:
- "bash scripts/evaluate/evaluate_lemmatizers.sh"
# Packaging
- name: package_sm_base
help: "Builds the small package locally"
script:
- "bash scripts/package.sh ${vars.base_model.model_name_sm} ${vars.base_model.package_name_sm} ${vars.base_model.package_version} frequency_lemmatizer"
- name: package_trf_base
help: "Builds the transformer package locally"
script:
- "bash scripts/package.sh ${vars.base_model.model_name_trf} ${vars.base_model.package_name_trf} ${vars.base_model.package_version} frequency_lemmatizer"
- name: package_sm_ner
help: "Builds the small final package locally"
script:
- "bash scripts/package.sh ${vars.ner_model.model_name_sm} ${vars.ner_model.package_name_sm} ${vars.ner_model.package_version} frequency_lemmatizer"
- name: package_trf_ner
help: "Builds the transformer package locally"
script:
- "bash scripts/package.sh ${vars.ner_model.model_name_trf} ${vars.ner_model.package_name_trf} ${vars.ner_model.package_version} frequency_lemmatizer"
- name: package_xlm_base
script:
- "bash scripts/package.sh ${vars.exp_models.model_name_xlm_base} dep_treebanks_xlm ${vars.exp_models.package_version} frequency_lemmatizer"
- name: package_trf_separate
script:
- "bash scripts/package.sh ${vars.exp_models.model_name_trf_proiel} dep_proiel_trf ${vars.exp_models.package_version} frequency_lemmatizer"
- "bash scripts/package.sh ${vars.exp_models.model_name_trf_perseus} dep_perseus_trf ${vars.exp_models.package_version} frequency_lemmatizer"
- name: package_xlm_separate
script:
- "bash scripts/package.sh ${vars.exp_models.model_name_xlm_proiel} dep_proiel_xlm ${vars.exp_models.package_version} frequency_lemmatizer"
- "bash scripts/package.sh ${vars.exp_models.model_name_xlm_perseus} dep_perseus_xlm ${vars.exp_models.package_version} frequency_lemmatizer"
# pushing to huggingface hub
- name: push_sm_base
help: "Pushes small package to HuggingFace (must be built before)"
script:
- "bash scripts/push.sh ${vars.base_model.model_name_sm} ${vars.base_model.package_name_sm} ${vars.base_model.package_version} ${vars.lang}"
- name: push_trf_base
help: "Pushes transformer package to HuggingFace (must be built before)"
script:
- "bash scripts/push.sh ${vars.base_model.model_name_trf} ${vars.base_model.package_name_trf} ${vars.base_model.package_version} ${vars.lang}"
- name: push_sm_ner
help: "Builds and pushes small package to HuggingFace"
script:
- "bash scripts/push.sh ${vars.ner_model.model_name_sm} ${vars.ner_model.package_name_sm} ${vars.ner_model.package_version} ${vars.lang}"
- name: push_trf_ner
help: "Builds and pushes transformer package to HuggingFace"
script:
- "bash scripts/push.sh ${vars.ner_model.model_name_trf} ${vars.ner_model.package_name_trf} ${vars.ner_model.package_version} ${vars.lang}"
- name: push_xlm_base
script:
- "bash scripts/push.sh ${vars.exp_models.model_name_xlm_base} dep_treebanks_xlm 0.0.1 grc"
- name: push_trf_separate
script:
- "bash scripts/push.sh ${vars.exp_models.model_name_trf_proiel} dep_proiel_trf ${vars.exp_models.package_version} grc"
- "bash scripts/push.sh ${vars.exp_models.model_name_trf_perseus} dep_perseus_trf ${vars.exp_models.package_version} grc"
- name: push_xlm_separate
script:
- "bash scripts/push.sh ${vars.exp_models.model_name_xlm_proiel} dep_proiel_xlm ${vars.exp_models.package_version} grc"
- "bash scripts/push.sh ${vars.exp_models.model_name_xlm_perseus} dep_perseus_xlm ${vars.exp_models.package_version} grc"