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
33469436
Commit
33469436
authored
Jan 18, 2018
by
Myle Ott
Browse files
Better warning message for inputs that are too long
parent
66314a60
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
fairseq/data.py
fairseq/data.py
+4
-3
No files found.
fairseq/data.py
View file @
33469436
...
@@ -297,9 +297,10 @@ def _make_batches(src, dst, indices, max_tokens, max_sentences, max_positions,
...
@@ -297,9 +297,10 @@ def _make_batches(src, dst, indices, max_tokens, max_sentences, max_positions,
if
ignore_invalid_inputs
:
if
ignore_invalid_inputs
:
ignored
.
append
(
idx
)
ignored
.
append
(
idx
)
continue
continue
raise
Exception
(
raise
Exception
((
"Unable to handle input id {} of size {} / {}."
.
format
(
"Sample #{} has size (src={}, dst={}) but max size is {}."
idx
,
src
.
sizes
[
idx
],
dst
.
sizes
[
idx
]))
" Skip this example with --skip-invalid-size-inputs-valid-test"
).
format
(
idx
,
src
.
sizes
[
idx
],
dst
.
sizes
[
idx
],
max_positions
))
sample_len
=
max
(
sample_len
,
src
.
sizes
[
idx
],
dst
.
sizes
[
idx
])
sample_len
=
max
(
sample_len
,
src
.
sizes
[
idx
],
dst
.
sizes
[
idx
])
num_tokens
=
(
len
(
batch
)
+
1
)
*
sample_len
num_tokens
=
(
len
(
batch
)
+
1
)
*
sample_len
...
...
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