Commit 3efc39ee authored by Yash Kumar Atri's avatar Yash Kumar Atri Committed by Facebook Github Bot
Browse files

Update data_utils.py for (#598)

Summary:
Correcting the syntax error in assert function cause of a character before error message.

Assertion and the code is working fine now, Tested with wmt-ende task.
Pull Request resolved: https://github.com/pytorch/fairseq/pull/598

Differential Revision: D14712846

Pulled By: myleott

fbshipit-source-id: 3f708aa2362ceecba19174750f9ffc9238537512
parent 2340832f
......@@ -156,7 +156,7 @@ def batch_by_size(
for idx in indices:
sample_lens.append(num_tokens_fn(idx))
sample_len = max(sample_len, sample_lens[-1])
assert sample_len <= max_tokens, f"sentence at index {idx} exceeds max_tokens limit!"
assert sample_len <= max_tokens, "sentence at index {idx} exceeds max_tokens limit!".format(idx=idx)
num_tokens = (len(batch) + 1) * sample_len
if is_batch_full(num_tokens):
mod_len = max(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment