Exemplo n.º 1
0
    def setup_opt(self):
        opt = Opt()
        config_path = '/app/src/nlp/config.yml'
        config = config_utils.parse_configuration_file(config_path)
        # opt['model_file'] = config['world_opt']['model_file']
        # opt['task'] = None
        opt['parlai_home'] = self.parlai_home
        opt['datapath'] = self.parlai_datapath
        opt['download_path'] = self.parlai_download
        opt['safety'] = 'all'
        opt.update(config['world_opt'])
        opt['config'] = config

        return opt
Exemplo n.º 2
0
    def _initialize_bart(self, opt: Opt) -> Opt:
        """
        Download and convert BART pre-trained models.

        Additionally, convert `init-fairseq-model` if necessary.

        :param opt:
            ParlAI-parsed options

        :return opt:
            return opt with BART-specific args.
        """
        if not opt.get('converting'):
            download(opt['datapath'])
            opt['init_model'] = os.path.join(opt['datapath'],
                                             'models/bart/bart_large/model')
        if opt.get('init_fairseq_model'):
            opt = self._convert_model(opt)
        opt.update(BART_ARGS)
        compare_init_model_opts(opt, opt)
        return opt