Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/forge/actors/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,16 @@ def split_keys(keys):
return [keys[i::n_fetchers] for i in range(n_fetchers)]

futures = []
for i, names in enumerate(split_keys(hf_param_names)):
fut = self.weight_fetchers.slice(procs=i).fetch.call_one(
version=version, param_names=names
)
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(
version=version, param_names=names
)

fut = tg.create_task(fetch_coro())
futures.append(fut)

sub_state_dicts = [await fut for fut in futures]

Expand Down
Loading