Skip to content
This repository was archived by the owner on Sep 1, 2024. It is now read-only.

Commit

Permalink
fix: replacing torch with numpy
Browse files Browse the repository at this point in the history
  • Loading branch information
renesweet24 committed Jun 5, 2024
1 parent 67cd6e0 commit 6e08c73
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions insights/api/insight_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ def update_scores(self, rewards: np.float32, uids: List[int]):
rewards = np.nan_to_num(rewards, 0)

# Check if `uids` is already a tensor and clone it to avoid the warning.
if isinstance(uids, np.array):
uids_tensor = uids.clone().detach()
if isinstance(uids, np.ndarray):
uids_tensor = uids.copy()
else:
uids_tensor = np.array(uids)

Expand Down
2 changes: 1 addition & 1 deletion neurons/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def get_commitment(netuid: int, uid: int, block: Optional[int] = None) -> str:
except bt.errors.MetadataError as e:
logger.warning("Skipping storing validator metadata", error = {'exception_type': e.__class__.__name__,'exception_message': str(e),'exception_args': e.args})
except Exception as e:
logger.warning(f"Skipping storing validator metadata, error: {e}")
logger.warning(f"Skipping storing validator metadata,", error = {'exception_type': e.__class__.__name__,'exception_message': str(e),'exception_args': e.args})

def get_miners_metadata(config, metagraph):
def get_commitment(netuid: int, uid: int, block: Optional[int] = None) -> str:
Expand Down
1 change: 1 addition & 0 deletions neurons/validators/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from random import randint
from insights import protocol
from neurons import logger
import numpy as np


class BenchmarkValidator:
Expand Down
2 changes: 1 addition & 1 deletion template/base/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def update_scores(self, rewards: np.float32, uids: List[int]):

# Check if `uids` is already a tensor and clone it to avoid the warning.
if isinstance(uids, np.ndarray):
uids_tensor = uids.clone().detach()
uids_tensor = uids.copy()
else:
uids_tensor = np.array(uids)

Expand Down

0 comments on commit 6e08c73

Please sign in to comment.