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
66d9fcf5
Commit
66d9fcf5
authored
Jan 22, 2018
by
Myle Ott
Browse files
Fix tests
parent
f9362e87
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
fairseq/utils.py
fairseq/utils.py
+5
-1
No files found.
fairseq/utils.py
View file @
66d9fcf5
...
@@ -16,10 +16,11 @@ import sys
...
@@ -16,10 +16,11 @@ import sys
from
torch.autograd
import
Variable
from
torch.autograd
import
Variable
from
torch.serialization
import
default_restore_location
from
torch.serialization
import
default_restore_location
from
fairseq
import
criterions
,
data
,
models
,
progress_bar
,
tokenizer
from
fairseq
import
criterions
,
progress_bar
,
tokenizer
def
parse_args_and_arch
(
parser
):
def
parse_args_and_arch
(
parser
):
from
fairseq
import
models
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
args
.
model
=
models
.
arch_model_map
[
args
.
arch
]
args
.
model
=
models
.
arch_model_map
[
args
.
arch
]
args
=
getattr
(
models
,
args
.
model
).
parse_arch
(
args
)
args
=
getattr
(
models
,
args
.
model
).
parse_arch
(
args
)
...
@@ -27,6 +28,7 @@ def parse_args_and_arch(parser):
...
@@ -27,6 +28,7 @@ def parse_args_and_arch(parser):
def
build_model
(
args
,
src_dict
,
dst_dict
):
def
build_model
(
args
,
src_dict
,
dst_dict
):
from
fairseq
import
models
assert
hasattr
(
models
,
args
.
model
),
'Missing model type'
assert
hasattr
(
models
,
args
.
model
),
'Missing model type'
return
getattr
(
models
,
args
.
model
).
build_model
(
args
,
src_dict
,
dst_dict
)
return
getattr
(
models
,
args
.
model
).
build_model
(
args
,
src_dict
,
dst_dict
)
...
@@ -144,6 +146,8 @@ def load_ensemble_for_inference(filenames, src_dict=None, dst_dict=None, data_di
...
@@ -144,6 +146,8 @@ def load_ensemble_for_inference(filenames, src_dict=None, dst_dict=None, data_di
The source and target dictionaries can be given explicitly, or loaded from
The source and target dictionaries can be given explicitly, or loaded from
the `data_dir` directory.
the `data_dir` directory.
"""
"""
from
fairseq
import
data
# load model architectures and weights
# load model architectures and weights
states
=
[]
states
=
[]
for
filename
in
filenames
:
for
filename
in
filenames
:
...
...
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