// Define criterion of each GPU.
if not opt.copy_attn:
criterion = onmt.Loss.NMTCriterion(dataset["dicts"]["tgt"].size(), opt)
else:
criterion = onmt.modules.CopyCriterion
After Change
// Define criterion of each GPU.
if not opt.copy_attn:
criterion = onmt.Loss.NMTCriterion(len(fields["tgt"].vocab), opt)
else:
criterion = onmt.modules.CopyCriterion