forked from jmyerston/greCy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproject.yml
365 lines (321 loc) · 17 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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
title: "Ancient Greek PROIEL and PERSEUS MODELS"
description: "This project trains seven spaCy models using the ancient Greek Universal Dependency treebanks Proiel and Perseus."
email: "jmyerston@ucsd.edu"
source: "https://universaldependencies.org/"
vars:
license: "MIT"
author: "Jacobo Myerston"
config_sm: "small"
config_md: "medium"
config_lg: "large"
config_trf_proiel: "transformer_proiel"
config_trf_perseus: "transformer_perseus"
config_nsm: "ner_sm"
config_nlg: "ner_lg"
config_ntrf: "transformer_ner"
config_lsm: "lemmatizer_sm"
config_llg: "lemmatizer_vec"
config_ltrf: "lemmatizer_trf"
lang: "grc"
treebank_proiel: "UD_Ancient_Greek-PROIEL"
treebank_perseus: "UD_Ancient_Greek-Perseus"
vectors_lg: "grc_floret_cbow_nn2_xn10_b200k_dim300.floret"
train_name_proiel: "grc_proiel-ud-train"
dev_name_proiel: "grc_proiel-ud-dev"
test_name_proiel: "grc_proiel-ud-test"
train_name_perseus: "grc_perseus-ud-train"
dev_name_perseus: "grc_perseus-ud-dev"
test_name_perseus: "grc_perseus-ud-test"
pack_name_proiel: "proiel"
pack_name_perseus: "perseus"
pack_name_grecy: "lemma"
pack_name_ner: "ner"
package_version: 3.7.5
gpu: 0
# These are the directories that the project needs. The project CLI will make
# sure that they always exist.
directories: ["assets", "corpus","training", "configs", "packages", "vectors"]
assets:
# - dest: "assets/${vars.treebank_proiel}"
# git:
# repo: "https://github.com/jmyerston/${vars.treebank_proiel}"
# branch: "master"
# path: ""
# - dest: "assets/${vars.treebank_perseus}"
# git:
# repo: "https://github.com/jmyerston/${vars.treebank_perseus}"
# branch: "master"
# path: ""
- dest: 'assets/${vars.vectors_lg}'
url: 'https://zenodo.org/record/5733373/files/grc_floret_cbow_nn2_xn10_b200k_dim300.floret'
workflows:
all:
- preprocess
- train-small-lemmatizer
- train-large-lemmatizer
- train-transformer-lemmatizer
- train-transformer-ner
- train-small-proiel
- train-small-perseus
- train-large-proiel
- train-large-perseus
- train-transformer-proiel
- train-transformer-perseus
- pack-small-proiel
- pack-small-perseus
- pack-large-proiel
- pack-large-perseus
- pack-transformer-proiel
- pack-transformer-perseus
- pack-transformer-ner
- pack-transformer-lemmatizer
commands:
- name: preprocess
help: "Convert the data to spaCy's format"
script:
- "mkdir -p vectors/large"
# - "python -m spacy convert assets/${vars.treebank_proiel}/${vars.train_name_proiel}.conllu corpus/parser/proiel/train --converter conllu --n-sents 10 --merge-subtokens"
# - "python -m spacy convert assets/${vars.treebank_proiel}/${vars.dev_name_proiel}.conllu corpus/parser/proiel/dev --converter conllu --n-sents 10 --merge-subtokens"
# - "python -m spacy convert assets/${vars.treebank_perseus}/${vars.train_name_perseus}.conllu corpus/parser/perseus/train --converter conllu --n-sents 10 --merge-subtokens"
# - "python -m spacy convert assets/${vars.treebank_perseus}/${vars.dev_name_perseus}.conllu corpus/parser/perseus/dev --converter conllu --n-sents 10 --merge-subtokens"
- "python -m spacy init vectors ${vars.lang} assets/${vars.vectors_lg} ./vectors/large --mode floret"
deps:
- "assets/${vars.treebank_proiel}/${vars.train_name_proiel}.conllu"
- "assets/${vars.treebank_proiel}/${vars.dev_name_proiel}.conllu"
- "assets/${vars.treebank_proiel}/${vars.test_name_proiel}.conllu"
- "assets/${vars.treebank_perseus}/${vars.train_name_perseus}.conllu"
- "assets/${vars.treebank_perseus}/${vars.dev_name_perseus}.conllu"
outputs:
- "corpus/parser/proiel/train/grc_proiel-ud-train.spacy"
- "corpus/parser/proiel/dev/grc_proiel-ud-dev.spacy"
- "corpus/parser/perseus/train/grc_perseus-ud-train.spacy"
- "corpus/parser/perseus/dev/grc_perseus-ud-dev.spacy"
- "vectors/${vars.vectors_lg}"
- name: train-small-lemmatizer
help: "Train the lemmatizer for the small model"
script:
- "mkdir -p training/lemmatizer/small"
- "python -m spacy train configs/${vars.config_lsm}.cfg --output training/lemmatizer/small --gpu-id ${vars.gpu} --paths.train corpus/lemmatizer/train --paths.dev corpus/lemmatizer/dev --nlp.lang=${vars.lang}"
deps:
- "corpus/lemmatizer/train/lemma_train.spacy"
- "corpus/lemmatizer/train/lemma_train.spacy"
- "configs/${vars.config_lsm}.cfg"
outputs:
- "training/lemmatizer/small"
- name: train-large-lemmatizer
help: "Train the lemmatizer for the large model"
script:
- "mkdir -p training/lemmatizer/large"
- "python -m spacy train configs/${vars.config_llg}.cfg --output training/lemmatizer/large --gpu-id ${vars.gpu} --paths.train corpus/lemmatizer/train --paths.dev corpus/lemmatizer/dev --paths.vectors vectors/large --nlp.lang=${vars.lang}"
deps:
- "corpus/lemmatizer/train/lemma_train.spacy"
- "corpus/lemmatizer/train/lemma_train.spacy"
- "configs/${vars.config_llg}.cfg"
outputs:
- "training/lemmatizer/large"
- name: train-transformer-lemmatizer
help: "Train the lemmatizer for the transformer model"
script:
- "mkdir -p training/lemmatizer/transformer"
- "python -m spacy train configs/${vars.config_ltrf}.cfg --output ./training/lemmatizer/transformer --gpu-id ${vars.gpu} --paths.train corpus/lemmatizer/train --paths.dev corpus/lemmatizer/dev --nlp.lang=${vars.lang}"
deps:
- "configs/${vars.config_ltrf}.cfg"
outputs:
- "training/lemmatizer/transformer"
### Training NER pipelines
- name: train-transformer-ner
help: "Train ${vars.treebank_proiel}"
script:
- "mkdir -p training/transformer/ner"
- "python -m spacy train configs/${vars.config_ntrf}.cfg --output training/transformer/ner --gpu-id ${vars.gpu} --paths.train corpus/parser/proiel/train/ner_train.spacy --paths.dev corpus/parser/proiel/dev/ner_dev.spacy --nlp.lang=${vars.lang}"
deps:
- "corpus/parser/proiel/train/ner_train.spacy"
- "corpus/parser/proiel/dev/ner_dev.spacy"
- "configs/${vars.config_ntrf}.cfg"
outputs:
- "training/ner/transformer"
## Training Parsers
- name: train-small-proiel
help: "Train ${vars.treebank_proiel}"
script:
- "mkdir -p training/small/proiel/assembled"
- "python -m spacy train configs/${vars.config_sm}.cfg --output training/small/proiel/assembled --gpu-id ${vars.gpu} --paths.train corpus/parser/proiel/train --paths.dev corpus/parser/proiel/dev --nlp.lang=${vars.lang}"
deps:
- "corpus/parser/proiel/train/grc_proiel-ud-train.spacy"
- "corpus/parser/proiel/train/ner_train.spacy"
- "corpus/parser/proiel/dev/grc_proiel-ud-dev.spacy"
- "corpus/parser/proiel/dev/ner_dev.spacy"
- "configs/${vars.config_sm}.cfg"
outputs:
- "training/small/proiel/assembled"
- name: train-small-perseus
help: "Train ${vars.treebank_perseus}"
script:
- "mkdir -p training/small/perseus/assembled"
- "python -m spacy train configs/${vars.config_sm}.cfg --output training/small/perseus/assembled --gpu-id ${vars.gpu} --paths.train corpus/parser/perseus/train --paths.dev corpus/parser/perseus/dev --nlp.lang=${vars.lang}"
deps:
- "corpus/parser/perseus/train/grc_perseus-ud-train.spacy"
- "corpus/parser/perseus/train/ner_train.spacy"
- "corpus/parser/perseus/dev/grc_perseus-ud-dev.spacy"
- "corpus/parser/perseus/dev/ner_dev.spacy"
- "configs/${vars.config_sm}.cfg"
outputs:
- "training/small/perseus/assembled"
- name: train-large-proiel
help: "Train ${vars.treebank_proiel}"
script:
- "mkdir -p training/large/assembled"
- "python -m spacy train configs/${vars.config_lg}.cfg --output training/large/proiel/assembled --gpu-id ${vars.gpu} --paths.train corpus/parser/proiel/train --paths.dev corpus/parser/proiel/dev --paths.vectors vectors/large --nlp.lang=${vars.lang}"
deps:
- "corpus/parser/proiel/train/grc_proiel-ud-train.spacy"
- "corpus/parser/proiel/train/ner_train.spacy"
- "corpus/parser/proiel/dev/grc_proiel-ud-dev.spacy"
- "corpus/parser/proiel/dev/ner_dev.spacy"
- "configs/${vars.config_lg}.cfg"
outputs:
- "training/large/proiel/assembled"
- name: train-large-perseus
help: "Train ${vars.treebank_perseus}"
script:
- "mkdir -p training/large/perseus/assembled"
- "python -m spacy train configs/${vars.config_lg}.cfg --output training/large/perseus/assembled --gpu-id ${vars.gpu} --paths.train corpus/parser/perseus/train --paths.dev corpus/parser/perseus/dev --paths.vectors vectors/large --nlp.lang=${vars.lang}"
deps:
- "corpus/parser/perseus/train/grc_perseus-ud-train.spacy"
- "corpus/parser/perseus/train/ner_train.spacy"
- "corpus/parser/perseus/dev/grc_perseus-ud-dev.spacy"
- "corpus/parser/perseus/dev/ner_dev.spacy"
- "configs/${vars.config_lg}.cfg"
outputs:
- "training/large/perseus/assembled"
- name: train-transformer-proiel
help: "Train ${vars.treebank_proiel}"
script:
- "mkdir -p training/transformer/proiel/assembled"
- "python -m spacy train configs/${vars.config_trf_proiel}.cfg --output training/transformer/proiel/assembled --gpu-id ${vars.gpu} --paths.train corpus/parser/proiel/train/grc_proiel-ud-train.spacy --paths.dev corpus/parser/proiel/dev/grc_proiel-ud-dev.spacy --nlp.lang=${vars.lang}"
deps:
- "corpus/parser/proiel/train/grc_proiel-ud-train.spacy"
- "corpus/parser/proiel/dev/grc_proiel-ud-dev.spacy"
- "configs/${vars.config_trf_proiel}.cfg"
outputs:
- "training/transformer/proiel/assembled"
- name: train-transformer-perseus
help: "Train ${vars.treebank_perseus}"
script:
- "mkdir -p training/transformer/perseus/assembled"
- "python -m spacy train configs/${vars.config_trf_perseus}.cfg --output training/transformer/perseus/assembled --gpu-id ${vars.gpu} --paths.train corpus/parser/perseus/train/grc_perseus-ud-train.spacy --paths.dev corpus/parser/perseus/dev/grc_perseus-ud-dev.spacy --nlp.lang=${vars.lang}"
deps:
- "corpus/parser/perseus/train/grc_perseus-ud-train.spacy"
- "corpus/parser/perseus/dev/grc_perseus-ud-dev.spacy"
- "configs/${vars.config_trf_perseus}.cfg"
outputs:
- "training/transformer/perseus/assembled"
## Packing
- name: pack-small-proiel
help: "pack the trained model"
script:
- "python -m spacy package training/small/proiel/assembled/model-best packages --name ${vars.pack_name_proiel}_sm --version ${vars.package_version} --build wheel --force"
deps:
- "training/small/proiel/assembled"
outputs_no_cache:
- "package/${vars.lang}_${vars.pack_name_proiel}_sm-${vars.package_version}/dist/grc_${vars.pack_name_proiel}config_sm-${vars.package_version}.tar.gz"
- name: pack-small-perseus
help: "pack the trained model"
script:
- "python -m spacy package training/small/perseus/assembled/model-best packages --name ${vars.pack_name_perseus}_sm --version ${vars.package_version} --build wheel --force"
deps:
- "training/small/perseus/assembled"
outputs_no_cache:
- "packages/${vars.lang}_${vars.pack_name_perseus}_sm-${vars.package_version}/dist/grc_${vars.pack_name_perseus}config_sm-${vars.package_version}.tar.gz"
- name: pack-large-proiel
help: "pack the trained model so it can be installed"
script:
- "python -m spacy package training/large/proiel/assembled/model-best packages --name ${vars.pack_name_proiel}_lg --version ${vars.package_version} --build wheel --force"
deps:
- "training/large/proiel/assembled/model-best"
outputs_no_cache:
- "packages/${vars.lang}_${vars.pack_name_proiel}_lg-${vars.package_version}/dist/grc_${vars.pack_name_proiel}config_lg-${vars.package_version}.tar.gz"
- name: pack-large-perseus
help: "pack the trained model so it can be installed"
script:
- "python -m spacy package training/large/perseus/assembled/model-best packages --name ${vars.pack_name_perseus}_lg --version ${vars.package_version} --build wheel --force"
deps:
- "training/large/perseus/assembled/model-best"
outputs_no_cache:
- "packages/${vars.lang}_${vars.pack_name_perseus}_lg-${vars.package_version}/dist/grc_${vars.pack_name_perseus}config_lg-${vars.package_version}.tar.gz"
- name: pack-transformer-proiel
help: "pack the trained model so it can be installed"
script:
- "python -m spacy package training/transformer/proiel/assembled/model-best packages --name ${vars.pack_name_proiel}_trf --version ${vars.package_version} --build wheel --force"
deps:
- "training/transformer/proiel/assembled/model-best"
outputs_no_cache:
- "packages/${vars.lang}_${vars.pack_name_proiel}_trf-${vars.package_version}/dist/grc_${vars.pack_name_proiel}config_trf-${vars.package_version}.tar.gz"
- name: pack-transformer-ner
help: "pack the trained model so it can be installed"
script:
- "python -m spacy package training/transformer/ner/model-best packages --name ${vars.pack_name_ner}_trf --version ${vars.package_version} --build wheel --force"
deps:
- "training/transformer/ner/model-best"
outputs_no_cache:
- "packages/${vars.lang}_${vars.pack_name_ner}_trf-${vars.package_version}/dist/grc_${vars.pack_name_ner}config_trf-${vars.package_version}.tar.gz"
- name: pack-transformer-perseus
help: "pack the trained model so it can be installed"
script:
- "python -m spacy package training/transformer/perseus/assembled/model-best packages --name ${vars.pack_name_perseus}_trf --version ${vars.package_version} --build wheel --force"
deps:
- "training/transformer/perseus/assembled/model-best"
outputs_no_cache:
- "packages/${vars.lang}_${vars.pack_name_perseus}_trf-${vars.package_version}/dist/grc_${vars.pack_name_perseus}config_trf-${vars.package_version}.tar.gz"
- name: pack-transformer-lemmatizer
help: "pack the trained model so it can be installed"
script:
- "python -m spacy package ./training/lemmatizer/greCy_lemmatizer/model-best packages --name ${vars.pack_name_grecy}_trf --version ${vars.package_version} --build wheel --force"
deps:
- "training/lemmatizer/greCy_lemmatizer/model-best"
outputs_no_cache:
- "packages/${vars.pack_name_grecy}_trf-${vars.package_version}/dist/grc_${vars.pack_name_grecy}config_trf-${vars.package_version}.tar.gz"
## Pushing the packages to Huggingface
- name: push-small-proiel
help: "Pushes the packd model to the huggingface hub"
script:
- "python -m spacy huggingface-hub push packages/${vars.lang}_${vars.pack_name_proiel}_sm-${vars.package_version}/dist/grc_${vars.pack_name_proiel}_sm-${vars.package_version}-py3-none-any.whl"
- name: push-large-proiel
help: "Pushes the packd model to the huggingface hub"
script:
- "python -m spacy huggingface-hub push packages/${vars.lang}_${vars.pack_name_proiel}_lg-${vars.package_version}/dist/grc_${vars.pack_name_proiel}_lg-${vars.package_version}-py3-none-any.whl"
- name: push-transformer-proiel
help: "Pushes the packd model to the huggingface hub"
script:
- "python -m spacy huggingface-hub push packages/${vars.lang}_${vars.pack_name_proiel}_trf-${vars.package_version}/dist/grc_${vars.pack_name_proiel}_trf-${vars.package_version}-py3-none-any.whl"
- name: push-small-perseus
help: "Pushes the packd model to the huggingface hub"
script:
- "python -m spacy huggingface-hub push packages/${vars.lang}_${vars.pack_name_perseus}_sm-${vars.package_version}/dist/grc_${vars.pack_name_perseus}_sm-${vars.package_version}-py3-none-any.whl"
- name: push-large-perseus
help: "Pushes the packd model to the huggingface hub"
script:
- "python -m spacy huggingface-hub push packages/${vars.lang}_${vars.pack_name_perseus}_lg-${vars.package_version}/dist/grc_${vars.pack_name_perseus}_lg-${vars.package_version}-py3-none-any.whl"
- name: push-transformer-perseus
help: "Pushes the packd model to the huggingface hub"
script:
- "python -m spacy huggingface-hub push packages/${vars.lang}_${vars.pack_name_perseus}_trf-${vars.package_version}/dist/grc_${vars.pack_name_perseus}_trf-${vars.package_version}-py3-none-any.whl"
- name: push-transformer-lemmatizer
help: "Pushes the packd model to the huggingface hub"
script:
- "python -m spacy huggingface-hub push packages/${vars.lang}_${vars.pack_name_grecy}_trf-${vars.package_version}/dist/grc_${vars.pack_name_grecy}_trf-${vars.package_version}-py3-none-any.whl"
- name: push-transformer-ner
help: "Pushes the packd model to the huggingface hub"
script:
- "python -m spacy huggingface-hub push packages/${vars.lang}_${vars.pack_name_ner}_trf-${vars.package_version}/dist/grc_${vars.pack_name_ner}_trf-${vars.package_version}-py3-none-any.whl"
## Cleaning Up
- name: clean-spring
help: "Clean directories"
script:
- "rm -rf packages"
- "rm -rf training"
- name: clean-all
help: "Clean directories"
script:
- "rm -rf packages"
- "rm -rf training"
- "rm -rf vectors"