You need to sign in or sign up before continuing.
Commit f701aa8c authored by Mohammad Sadegh Rasooli's avatar Mohammad Sadegh Rasooli Committed by Facebook Github Bot
Browse files

Passing kwargs in setup_task in fairseq_task (#670)

Summary:
Pull Request resolved: https://github.com/pytorch/fairseq/pull/670

Pytorch-translate task needs to use extra arguments (such as vocabulary objects). By passing kwargs, we are able to have the ability to have extra arguments in setup_task

Reviewed By: akinh, pipibjc

Differential Revision: D15086810

fbshipit-source-id: 555f7976020eaac1febb8226f5a0055af0407ea6
parent 57b6a6db
......@@ -15,8 +15,8 @@ TASK_REGISTRY = {}
TASK_CLASS_NAMES = set()
def setup_task(args):
return TASK_REGISTRY[args.task].setup_task(args)
def setup_task(args, **kwargs):
return TASK_REGISTRY[args.task].setup_task(args, **kwargs)
def register_task(name):
......
......@@ -62,7 +62,7 @@ class FairseqTask(object):
Args:
args (argparse.Namespace): parsed command-line arguments
"""
return cls(args)
return cls(args, **kwargs)
def load_dataset(self, split, combine=False, **kwargs):
"""Load a given dataset split.
......
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