We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6a16716 commit a4a9399Copy full SHA for a4a9399
src/forge/actors/generator.py
@@ -270,11 +270,16 @@ def split_keys(keys):
270
return [keys[i::n_fetchers] for i in range(n_fetchers)]
271
272
futures = []
273
- for i, names in enumerate(split_keys(hf_param_names)):
274
- fut = self.weight_fetchers.slice(procs=i).fetch.call_one(
275
- version=version, param_names=names
276
- )
277
- futures.append(fut)
+ async with asyncio.TaskGroup() as tg:
+ for i, names in enumerate(split_keys(hf_param_names)):
+
+ async def fetch_coro():
+ return self.weight_fetchers.slice(procs=i).fetch.call_one(
278
+ version=version, param_names=names
279
+ )
280
281
+ fut = tg.create_task(fetch_coro())
282
+ futures.append(fut)
283
284
sub_state_dicts = [await fut for fut in futures]
285
0 commit comments