Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
JoeyNMT Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Simon Will
JoeyNMT Server
Commits
39477bce
Commit
39477bce
authored
3 years ago
by
Simon Will
Browse files
Options
Downloads
Patches
Plain Diff
Add simulation option for saving one feedback at a time
parent
99ab7156
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
simulate_training.py
+17
-15
17 additions, 15 deletions
simulate_training.py
with
17 additions
and
15 deletions
simulate_training.py
+
17
−
15
View file @
39477bce
...
...
@@ -107,27 +107,31 @@ class NLMapsMT:
logging
.
error
(
'
Response status code: {}
'
.
format
(
resp
.
status_code
))
def
main
(
dataset_dir
,
model
,
wait_time
=
3
,
validation_freq
=
10
,
dev2
=
False
,
def
main
(
dataset_dir
,
model
,
wait_time
=
None
,
validation_freq
=
10
,
dev2
=
False
,
test_as_dev
=
False
,
base_url
=
NLMAPS_MT_BASE_URL
,
user_id
=
None
):
data
=
load_data
(
dataset_dir
)
nlmaps_mt
=
NLMapsMT
(
base_url
,
model
=
model
,
user_id
=
user_id
)
if
validation
_fre
q
:
def
wait_until
_fre
e
()
:
while
nlmaps_mt
.
is_training
():
time
.
sleep
(
1
)
if
validation_freq
:
wait_until_free
()
nlmaps_mt
.
validate
(
'
dev
'
)
while
nlmaps_mt
.
is_training
():
time
.
sleep
(
1
)
wait_until_free
()
if
dev2
:
nlmaps_mt
.
validate
(
'
dev2
'
)
while
nlmaps_mt
.
is_training
():
time
.
sleep
(
1
)
wait_until_free
()
for
train_idx
,
(
train
,
dev
,
test
)
in
enumerate
(
zip_longest
(
data
[
'
train
'
],
data
[
'
dev
'
],
data
[
'
test
'
]),
start
=
1
):
if
train
:
nlmaps_mt
.
save_feedback
(
train
,
'
train
'
)
time
.
sleep
(
wait_time
)
if
wait_time
is
None
:
wait_until_free
()
else
:
time
.
sleep
(
wait_time
)
if
dev
:
nlmaps_mt
.
save_feedback
(
dev
,
'
dev
'
)
if
test
:
...
...
@@ -135,15 +139,12 @@ def main(dataset_dir, model, wait_time=3, validation_freq=10, dev2=False,
nlmaps_mt
.
save_feedback
(
test
,
split
)
if
validation_freq
and
train_idx
%
validation_freq
==
0
:
while
nlmaps_mt
.
is_training
():
time
.
sleep
(
1
)
wait_until_free
()
nlmaps_mt
.
validate
(
'
dev
'
)
while
nlmaps_mt
.
is_training
():
time
.
sleep
(
1
)
wait_until_free
()
if
dev2
:
nlmaps_mt
.
validate
(
'
dev2
'
)
while
nlmaps_mt
.
is_training
():
time
.
sleep
(
1
)
wait_until_free
()
def
parse_args
():
...
...
@@ -151,9 +152,10 @@ def parse_args():
parser
.
add_argument
(
'
dataset_dir
'
,
help
=
'
Dataset directory. Must contain
'
'
six files matching in *{train,dev,test}.{en,lin}
'
)
parser
.
add_argument
(
'
model
'
,
help
=
'
Path to model config yaml file
'
)
parser
.
add_argument
(
'
--wait-time
'
,
type
=
int
,
default
=
3
,
parser
.
add_argument
(
'
--wait-time
'
,
type
=
int
,
help
=
'
Number of seconds to wait between saving pieces
'
'
of feedback.
'
)
'
of feedback. Default is waiting until training is
'
'
done.
'
)
parser
.
add_argument
(
'
--validation-freq
'
,
type
=
int
,
default
=
10
,
help
=
'
Validate on dev from model config after every N
'
'
pieces of feedback.
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment