Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
nlp
ahisto-modules
Named Entity Recognition Experiments
Commits
c4c8ffd3
Commit
c4c8ffd3
authored
Aug 15, 2022
by
Vít Novotný
Browse files
Use fine-tuning schedule to train NER models
parent
04b847a2
Pipeline
#146492
passed with stage
in 8 minutes and 44 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ahisto_named_entity_search/default.ini
View file @
c4c8ffd3
...
...
@@ -102,3 +102,6 @@ schedule = fair-sequential-schedule
[recognition.FairSequentialSchedule]
maximum_number_of_training_epochs_per_objective
=
1
[recognition.FineTuningSchedule]
maximum_number_of_training_epochs_per_objective
=
5
ahisto_named_entity_search/recognition/schedule.py
View file @
c4c8ffd3
...
...
@@ -30,6 +30,25 @@ class FairSequentialSchedule(SequentialSchedule):
yield
objective
class
FineTuningSchedule
(
SequentialSchedule
):
CONFIG
=
_CONFIG
[
'recognition.FineTuningSchedule'
]
MAX_NUM_TRAIN_EPOCHS
=
CONFIG
.
getint
(
'maximum_number_of_training_epochs_per_objective'
)
label
=
'fine_tuning'
def
_sample_objectives
(
self
,
split
:
str
)
->
Iterable
[
Objective
]:
for
objective
in
self
.
objectives
[
split
].
values
():
starting_epoch
=
objective
.
epoch
while
True
:
if
objective
in
self
.
converged_objectives
and
not
self
.
args
.
log_converged_objectives
:
break
if
split
==
'train'
:
num_train_epochs
=
objective
.
epoch
-
starting_epoch
if
num_train_epochs
>=
self
.
MAX_NUM_TRAIN_EPOCHS
:
break
yield
objective
def
get_schedule
(
schedule_name
:
str
,
objectives
:
Iterable
[
Objective
],
adaptation_arguments
:
AdaptationArguments
)
->
Schedule
:
objectives
=
list
(
objectives
)
...
...
@@ -37,6 +56,8 @@ def get_schedule(schedule_name: str, objectives: Iterable[Objective],
schedule
=
SequentialSchedule
(
objectives
,
adaptation_arguments
)
elif
schedule_name
==
'fair-sequential'
:
schedule
=
FairSequentialSchedule
(
objectives
,
adaptation_arguments
)
elif
schedule_name
==
'fine-tuning'
:
schedule
=
FineTuningSchedule
(
objectives
,
adaptation_arguments
)
elif
schedule_name
==
'parallel'
:
schedule
=
ParallelSchedule
(
objectives
,
adaptation_arguments
)
else
:
...
...
scripts/03_train_ner_models.sh
View file @
c4c8ffd3
...
...
@@ -8,7 +8,7 @@ IMAGE_NAME=ahisto/named-entity-search:latest
ROOT_PATH
=
/nlp/projekty/ahisto/public_html/named-entity-search/results/
ANNOTATION_PATH
=
/nlp/projekty/ahisto/annotations/
OCR_EVAL_PATH
=
/nlp/projekty/ahisto/ahisto-ocr-eval
SCHEDULE_NAME
=
parallel
SCHEDULE_NAME
=
fine-tuning
DOCKER_BUILDKIT
=
1 docker build
--build-arg
UID
=
"
$(
id
-u
)
"
--build-arg
GID
=
"
$(
id
-g
)
"
--build-arg
UNAME
=
"
$(
id
-u
-n
)
"
.
-f
scripts//03_train_ner_models.Dockerfile
-t
"
$IMAGE_NAME
"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment