MCPcopy Create free account
hub / github.com/Mercury7353/PyBench / main

Function main

inference.py:166–194  ·  view source on GitHub ↗
(config_path: str, task_path: str, output_path: str)

Source from the content-addressed store, hash-verified

164 print("======Write Json=======")
165
166def main(config_path: str, task_path: str, output_path: str):
167 os.makedirs("Check", exist_ok=True)
168 os.makedirs("output", exist_ok=True)
169 logger.info("started")
170 yaml = ruamel.yaml.YAML()
171 config=yaml.load(open(config_path, "r"))
172 logger.info("config loaded")
173 llm = build_llm(config["llm"]["type"], config["llm"]["args"])
174 logger.info("llm built")
175 system_prompt_template = config["system_prompt_template"]
176 max_turns = config["max_turns"]
177 test_data = json.load(open(task_path, "r"))
178 logger.info(f"total tasks: {len(test_data)}")
179 if os.path.exists(output_path):
180 processed_ids = set(
181 [json.loads(line)["index"] for line in open(output_path, "r")]
182 )
183 else:
184 processed_ids = set()
185
186 with ThreadPoolExecutor(max_workers=16) as executor:
187 futures = [
188 executor.submit(process_task, task, config, llm, system_prompt_template, max_turns, output_path, processed_ids)
189 for task in test_data
190 ]
191 for future in futures:
192 future.result() # 等待所有任务完成
193
194 logger.info("finished")
195
196if __name__ == "__main__":
197 fire.Fire(main)

Callers

nothing calls this directly

Calls 1

build_llmFunction · 0.90

Tested by

no test coverage detected