Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add downloading time to averager #618

Merged
Merged
Changes from all commits
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
5 changes: 4 additions & 1 deletion hivemind/averaging/averager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import random
import signal
import threading
import time
import weakref
from dataclasses import asdict
from typing import Any, AsyncIterator, Dict, Optional, Sequence, Tuple, Union
Expand Down Expand Up @@ -78,7 +79,7 @@
local tensors for averaging
:param allow_state_sharing: if set to True, other peers can download this peer's state. Can be overwritten
with averager.allow_state_sharing = True / False
:param declare_state_period: re-declare averager as a donor for load_state_from_peers every this many seconds

Check failure on line 82 in hivemind/averaging/averager.py

View workflow job for this annotation

GitHub Actions / codespell

re-declare ==> redeclare
:param allreduce_timeout: spend at most this many seconds for allreduce (after group is formed)
:param next_chunk_timeout: during all-reduce and load_state_from_peers, if peer does not send next data chunk in
this number of seconds, consider it failed and proceed with remaining peers. default: no timeout
Expand Down Expand Up @@ -700,6 +701,7 @@
metadata = None
for peer in sorted(peer_priority.keys(), key=peer_priority.get, reverse=True):
if peer != self.peer_id:
t0 = time.monotonic()
logger.info(f"Downloading parameters from peer {peer}")
try:
stub = self.get_stub(self._p2p, peer, namespace=self.prefix)
Expand All @@ -722,7 +724,8 @@
logger.debug(f"Peer {peer} did not send its state")
continue

logger.info(f"Finished downloading state from {peer}")
t1 = time.monotonic()
logger.info(f"Finished downloading state in {t1 - t0:.3f}s from {peer}")
future.set_result((metadata, tensors))
return
except Exception as e:
Expand Down
Loading