From aab1dad737eba3ce5cce578a5775cec12e0f98ab Mon Sep 17 00:00:00 2001 From: Aleksandr Borzunov Date: Sat, 15 Jul 2023 05:13:21 +0000 Subject: [PATCH] Fix Python 3.7 --- src/petals/server/server.py | 2 +- src/petals/utils/ping.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/petals/server/server.py b/src/petals/server/server.py index 21e728a5f..e5076e7e4 100644 --- a/src/petals/server/server.py +++ b/src/petals/server/server.py @@ -8,8 +8,8 @@ import time from typing import Dict, List, Optional, Sequence, Union -import torch import hivemind +import torch from hivemind import DHT, MAX_DHT_TIME_DISCREPANCY_SECONDS, BatchTensorDescriptor, get_dht_time from hivemind.moe.server.layers import add_custom_models_from_file from hivemind.moe.server.runtime import Runtime diff --git a/src/petals/utils/ping.py b/src/petals/utils/ping.py index 177a5f6d6..8c7d819e6 100644 --- a/src/petals/utils/ping.py +++ b/src/petals/utils/ping.py @@ -42,7 +42,7 @@ def __init__(self, dht: hivemind.DHT, *, ema_alpha: float = 0.1, expiration: flo def ping(self, peer_ids: Sequence[hivemind.PeerID], **kwargs): current_rtts = self.dht.run_coroutine(partial(ping_parallel, peer_ids, **kwargs)) - logger.debug(f"Current RTTs: {current_rtts=}") + logger.debug(f"Current RTTs: {current_rtts}") expiration = hivemind.get_dht_time() + self.expiration for peer_id, rtt in current_rtts.items(): @@ -54,7 +54,7 @@ def ping(self, peer_ids: Sequence[hivemind.PeerID], **kwargs): def fastest(self, n_peers: int) -> Dict[hivemind.PeerID, float]: with self.ping_emas.freeze(): smoothed_rtts = {peer_id: rtt.value for peer_id, rtt in self.ping_emas.items()} - logger.debug(f"Smothed RTTs: {smoothed_rtts=}") + logger.debug(f"Smothed RTTs: {smoothed_rtts}") fastest_rtts = sorted(smoothed_rtts.items(), key=lambda item: item[1])[:n_peers] return dict(fastest_rtts)