Example #1
0
    def _run_final_extra_eval(self, opt):
        final_valid_opt = copy.deepcopy(opt)
        final_valid_opt_raw = Opt.load_init(opt['final_extra_opt'])
        final_datatype = final_valid_opt_raw["datatype"]
        for k, v in final_valid_opt_raw.items():
            final_valid_opt[k] = v
        final_max_exs = (
            final_valid_opt['validation_max_exs']
            if final_valid_opt.get('short_final_eval')
            else -1
        )
        final_valid_world = load_eval_worlds(
            self.agent, final_valid_opt, final_datatype
        )
        final_valid_report = self._run_eval(
            final_valid_world,
            final_valid_opt,
            final_datatype,
            final_max_exs,
            write_log=True,
            extra_log_suffix="_extra",
        )
        if opt['wandb_log'] and is_primary_worker():
            self.wb_logger.log_final(final_datatype, final_valid_report)

        return final_valid_report
Example #2
0
    def _load_known_opts(self, optfile, parsed):
        """
        Pull in CLI args for proper models/tasks/etc.

        Called before args are parsed; ``_load_opts`` is used for actually overriding
        opts after they are parsed.
        """
        new_opt = Opt.load_init(optfile)
        for key, value in new_opt.items():
            # existing command line parameters take priority.
            if key not in parsed or parsed[key] is None:
                parsed[key] = value
Example #3
0
 def _load_opts(self, opt):
     optfile = opt.get('init_opt')
     new_opt = Opt.load_init(optfile)
     for key, value in new_opt.items():
         # existing command line parameters take priority.
         if key not in opt:
             if opt.get('allow_missing_init_opts', False):
                 logging.warning(
                     f'The "{key}" key in {optfile} will not be loaded, because it '
                     f'does not exist in the target opt.')
             else:
                 raise RuntimeError(
                     'Trying to set opt from file that does not exist: ' +
                     str(key))
         if key not in opt['override']:
             opt[key] = value
             opt['override'][key] = value