-
Notifications
You must be signed in to change notification settings - Fork 0
/
project.yml
106 lines (97 loc) · 3.67 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
title: "MeasNER : Bio NER for Counts and Measurements"
description: "NER trained with BiomedNLP-PubMedBERT-base-uncased-abstract on MeasEval data for Counts and Measurements"
# Variables can be referenced across the project.yml using ${vars.var_name}
vars:
name: "measner"
lang: "en"
train: "train.json"
dev: "dev.json"
test: "test.json"
version: "0.1"
# Set your GPU ID, -1 is CPU
gpu_id: 0
# These are the directories that the project needs. The project CLI will make
# sure that they always exist.
directories: ["assets", "corpus", "configs", "training", "scripts", "packages"]
# Assets that should be downloaded or available in the directory. We're shipping
# them with the project, so they won't have to be downloaded.
assets:
- dest: "assets/train.json"
description: "Train Data"
- dest: "assets/dev.json"
description: "Eval Data"
# Workflows are sequences of commands (see below) executed in order. You can
# run them via "spacy project run [workflow]". If a commands's inputs/outputs
# haven't changed, it won't be re-run.
workflows:
all:
- convert
- create-config
- train
- evaluate
train-measner:
- convert
- create-config
- train
- evaluate
- package
# Project commands, specified in a style similar to CI config files (e.g. Azure
# pipelines). The name is the command name that lets you trigger the command
# via "spacy project run [command] [path]". The help message is optional and
# shown when executing "spacy project run [optional command] [path] --help".
commands:
- name: "convert"
help: "Convert the data to spaCy's binary format"
script:
- "python scripts/convert.py ${vars.lang} assets/${vars.train} corpus/train.spacy"
- "python scripts/convert.py ${vars.lang} assets/${vars.dev} corpus/dev.spacy"
- "python scripts/convert.py ${vars.lang} assets/${vars.test} corpus/test.spacy"
deps:
- "assets/${vars.train}"
- "assets/${vars.dev}"
- "assets/${vars.test}"
- "scripts/convert.py"
outputs:
- "corpus/train.spacy"
- "corpus/dev.spacy"
- "corpus/test.spacy"
- name: "create-config"
help: "Create a new config with an NER pipeline component"
script:
- "python -m spacy init fill-config configs/base_config.cfg configs/config.cfg"
outputs:
- "configs/config.cfg"
- name: "train"
help: "Train the NER model"
script:
- "python -m spacy train configs/config.cfg --output training/ --paths.train corpus/train.spacy --paths.dev corpus/dev.spacy --training.eval_frequency 10 --training.patience 50 --gpu-id ${vars.gpu_id}"
deps:
- "configs/config.cfg"
- "corpus/train.spacy"
- "corpus/dev.spacy"
outputs:
- "training/model-best"
- name: "evaluate"
help: "Evaluate the model and export metrics"
script:
- "python -m spacy evaluate training/model-best corpus/dev.spacy --output training/metrics.json"
deps:
- "corpus/dev.spacy"
- "training/model-best"
outputs:
- "training/metrics.json"
- name: package
help: "Package the trained model as a pip package"
script:
- "python -m spacy package training/model-best packages --name ${vars.name} --version ${vars.version} --code measner.py --force"
deps:
- "training/model-best"
outputs_no_cache:
- "packages/${vars.lang}_${vars.name}-${vars.version}/dist/${vars.lang}_${vars.name}-${vars.version}.tar.gz"
- name: visualize-model
help: Visualize the model's output interactively using Streamlit
script:
- "streamlit run scripts/visualize_model.py training/model-best \"I saw Shaka Khan in London.\""
deps:
- "scripts/visualize_model.py"
- "training/model-best"