MCPcopy Create free account
hub / github.com/THUDM/AgentTuning / predict_all

Method predict_all

AgentBench.old/src/tasks/alfworld/task.py:95–116  ·  view source on GitHub ↗
(self, agent: Agent, inputs: List)

Source from the content-addressed store, hash-verified

93 return ret
94
95 def predict_all(self, agent: Agent, inputs: List) -> List:
96 print(f"Start Predicting All ...")
97
98 count = self.workers
99 if self.worker_limit:
100 count = min(self.workers, self.worker_limit)
101
102 executor = ProcessPoolExecutor(max_workers=count)
103 results = []
104 processes = []
105
106 parameters = [(input_, agent, index) for index, input_ in enumerate(inputs)]
107 for idx, parameter in enumerate(parameters):
108 future = executor.submit(self.call_wrap, parameter)
109 processes.append(future)
110
111 with tqdm(total=len(parameters)) as pbar:
112 for process in as_completed(processes):
113 results.append(process.result())
114 pbar.update(1)
115
116 return results
117
118 def call_wrap(self, parameters):
119 data_item, agent, index = parameters

Callers

nothing calls this directly

Calls 1

updateMethod · 0.80

Tested by

no test coverage detected