set tgt_lang of MBart Tokenizer for summarization (#10205)

This commit is contained in:
Zhang Cheng 2021-02-16 23:39:37 +09:00 committed by GitHub
parent 5c2d66a2f5
commit df1b0fb54d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -386,7 +386,7 @@ def main():
# For translation we set the codes of our source and target languages (only useful for mBART, the others will
# ignore those attributes).
if data_args.task.startswith("translation"):
if data_args.task.startswith("translation") or isinstance(tokenizer, (MBartTokenizer, MBartTokenizerFast)):
if data_args.source_lang is not None:
tokenizer.src_lang = data_args.source_lang
if data_args.target_lang is not None: