MCPcopy Create free account
hub / github.com/InternScience/SciReason / run

Method run

opencompass/tasks/openicl_attack.py:68–89  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

66 return sorted_prompts
67
68 def run(self):
69 self.logger.info(f'Task {task_abbr_from_cfg(self.cfg)}')
70 for model_cfg, dataset_cfgs in zip(self.model_cfgs, self.dataset_cfgs):
71 self.max_out_len = model_cfg.get('max_out_len', None)
72 self.batch_size = model_cfg.get('batch_size', None)
73 self.model = build_model_from_cfg(model_cfg)
74
75 for dataset_cfg in dataset_cfgs:
76 self.model_cfg = model_cfg
77 self.dataset_cfg = dataset_cfg
78 self.infer_cfg = self.dataset_cfg['infer_cfg']
79 self.dataset = build_dataset_from_cfg(self.dataset_cfg)
80 self.sub_cfg = {
81 'models': [self.model_cfg],
82 'datasets': [[self.dataset_cfg]],
83 }
84 out_path = get_infer_output_path(
85 self.model_cfg, self.dataset_cfg,
86 osp.join(self.work_dir, 'attack'))
87 if osp.exists(out_path):
88 continue
89 self._inference()
90
91 def _inference(self):
92 self.logger.info(

Callers 1

openicl_attack.pyFile · 0.45

Calls 6

_inferenceMethod · 0.95
task_abbr_from_cfgFunction · 0.90
build_model_from_cfgFunction · 0.90
build_dataset_from_cfgFunction · 0.90
get_infer_output_pathFunction · 0.90
getMethod · 0.80

Tested by

no test coverage detected