Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Fairseq
Commits
891f2307
Commit
891f2307
authored
Jun 21, 2018
by
Mehdi Drissi
Browse files
Merge branch 'master' of
https://github.com/pytorch/fairseq
into minor_fixes
parents
762956a5
b458977a
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
10 deletions
+5
-10
tests/utils.py
tests/utils.py
+3
-0
train.py
train.py
+2
-10
No files found.
tests/utils.py
View file @
891f2307
...
@@ -108,6 +108,9 @@ class TestEncoder(FairseqEncoder):
...
@@ -108,6 +108,9 @@ class TestEncoder(FairseqEncoder):
def
forward
(
self
,
src_tokens
,
src_lengths
):
def
forward
(
self
,
src_tokens
,
src_lengths
):
return
src_tokens
return
src_tokens
def
reorder_encoder_out
(
self
,
encoder_out
,
new_order
):
return
encoder_out
.
index_select
(
0
,
new_order
)
class
TestIncrementalDecoder
(
FairseqIncrementalDecoder
):
class
TestIncrementalDecoder
(
FairseqIncrementalDecoder
):
def
__init__
(
self
,
args
,
dictionary
):
def
__init__
(
self
,
args
,
dictionary
):
...
...
train.py
View file @
891f2307
...
@@ -287,16 +287,8 @@ def save_checkpoint(args, trainer, epoch_itr, val_loss):
...
@@ -287,16 +287,8 @@ def save_checkpoint(args, trainer, epoch_itr, val_loss):
checkpoints
=
[
os
.
path
.
join
(
args
.
save_dir
,
fn
)
for
fn
,
cond
in
checkpoint_conds
.
items
()
if
cond
]
checkpoints
=
[
os
.
path
.
join
(
args
.
save_dir
,
fn
)
for
fn
,
cond
in
checkpoint_conds
.
items
()
if
cond
]
if
len
(
checkpoints
)
>
0
:
if
len
(
checkpoints
)
>
0
:
for
fn
in
checkpoints
:
for
cp
in
checkpoints
:
if
os
.
path
.
exists
(
fn
):
trainer
.
save_checkpoint
(
cp
,
extra_state
)
os
.
remove
(
fn
)
if
not
end_of_epoch
and
args
.
keep_interval_updates
>
0
:
for
cp
in
checkpoints
:
trainer
.
save_checkpoint
(
cp
,
extra_state
)
else
:
trainer
.
save_checkpoint
(
checkpoints
[
0
],
extra_state
)
for
fn
in
checkpoints
[
1
:]:
os
.
symlink
(
os
.
path
.
basename
(
checkpoints
[
0
]),
fn
)
if
not
end_of_epoch
and
args
.
keep_interval_updates
>
0
:
if
not
end_of_epoch
and
args
.
keep_interval_updates
>
0
:
# remove old checkpoints; checkpoints are sorted in descending order
# remove old checkpoints; checkpoints are sorted in descending order
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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