mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 10:12:23 +06:00
XLM use_lang_embedding flag in run_generation
This commit is contained in:
parent
c2c2ca0fdb
commit
ecc4f1bdfa
@ -177,7 +177,8 @@ def main():
|
||||
while True:
|
||||
xlm_lang = None
|
||||
# XLM Language usage detailed in the issues #1414
|
||||
if args.model_type in ["xlm"] and hasattr(tokenizer, 'lang2id'):
|
||||
if args.model_type in ["xlm"] and hasattr(tokenizer, 'lang2id') and hasattr(model.config, 'use_lang_emb') \
|
||||
and model.config.use_lang_emb:
|
||||
if args.xlm_lang:
|
||||
language = args.xlm_lang
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user