@classmethod
def setup_task(cls, args, **kwargs):
    'Setup the task (e.g., load dictionaries).\n\n        Args:\n            args (argparse.Namespace): parsed command-line arguments\n        '
    args.left_pad_source = utils.eval_bool(args.left_pad_source)
    args.left_pad_target = utils.eval_bool(args.left_pad_target)
    paths = utils.split_paths(args.data)
    assert (len(paths) > 0)
    if ((args.source_lang is None) or (args.target_lang is None)):
        (args.source_lang, args.target_lang) = data_utils.infer_language_pair(paths[0])
    if ((args.source_lang is None) or (args.target_lang is None)):
        raise Exception('Could not infer language pair, please provide it explicitly')
    src_dict = cls.load_dictionary(os.path.join(paths[0], 'dict.{}.txt'.format(args.source_lang)))
    tgt_dict = cls.load_dictionary(os.path.join(paths[0], 'dict.{}.txt'.format(args.target_lang)))
    assert (src_dict.pad() == tgt_dict.pad())
    assert (src_dict.eos() == tgt_dict.eos())
    assert (src_dict.unk() == tgt_dict.unk())
    logger.info('[{}] dictionary: {} types'.format(args.source_lang, len(src_dict)))
    logger.info('[{}] dictionary: {} types'.format(args.target_lang, len(tgt_dict)))
    return cls(args, src_dict, tgt_dict)
Setup the task (e.g., load dictionaries).

Args:
    args (argparse.Namespace): parsed command-line arguments
@classmethod
def setup_task(cls, args, **kwargs):
    'Setup the task (e.g., load dictionaries).\n\n        Args:\n            args (argparse.Namespace): parsed command-line arguments\n        '
    args.left_pad_source = utils.eval_bool(args.left_pad_source)
    args.left_pad_target = utils.eval_bool(args.left_pad_target)
    paths = utils.split_paths(args.data)
    assert (len(paths) > 0)
    if ((args.source_lang is None) or (args.target_lang is None)):
        (args.source_lang, args.target_lang) = data_utils.infer_language_pair(paths[0])
    if ((args.source_lang is None) or (args.target_lang is None)):
        raise Exception('Could not infer language pair, please provide it explicitly')
    src_dict = cls.load_dictionary(os.path.join(paths[0], 'dict.{}.txt'.format(args.source_lang)))
    tgt_dict = cls.load_dictionary(os.path.join(paths[0], 'dict.{}.txt'.format(args.target_lang)))
    assert (src_dict.pad() == tgt_dict.pad())
    assert (src_dict.eos() == tgt_dict.eos())
    assert (src_dict.unk() == tgt_dict.unk())
    logger.info('[{}] dictionary: {} types'.format(args.source_lang, len(src_dict)))
    logger.info('[{}] dictionary: {} types'.format(args.target_lang, len(tgt_dict)))
    return cls(args, src_dict, tgt_dict)