Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion openvalidators/neuron.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ def __init__(self):
self.wallet = bt.wallet(config=self.config)
self.wallet.create_if_non_existent()
if not self.config.wallet._mock:
self.wallet.reregister(subtensor=self.subtensor, netuid=self.config.netuid)
bt.utils.reregister(
wallet = self.wallet,
subtensor=self.subtensor,
netuid=self.config.netuid
)
bt.logging.debug(str(self.wallet))

# Init metagraph.
Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bittensor==5.2.0
transformers<=4.28.0
bittensor>=5.3.2,<6.0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which one is bittensor version 6.0.0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revolution. Also just the next major, so we avoid breaking API changes

transformers<=4.28.0
wandb==0.15.3
datasets==2.12.0
plotly==5.14.1
Expand All @@ -10,3 +10,4 @@ click==8.1.3
torchmetrics
sentencepiece
numpy==1.21.6
bittensor-wallet>=0.0.4,<1.0.0
31 changes: 31 additions & 0 deletions tests/helpers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# The MIT License (MIT)
# Copyright © 2023 Opentensor Technologies

# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all copies or substantial portions of
# the Software.

# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
# THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

from bittensor_wallet.mock import MockWallet as _MockWallet, utils as _mock_wallet_utils

_get_mock_coldkey = _mock_wallet_utils.get_mock_coldkey
_get_mock_hotkey = _mock_wallet_utils.get_mock_hotkey
_get_mock_keypair = _mock_wallet_utils.get_mock_keypair
_get_mock_wallet = _mock_wallet_utils.get_mock_wallet


def __mock_wallet_factory__(*args, **kwargs) -> _MockWallet:
"""Returns a mock wallet object."""

mock_wallet = _get_mock_wallet()

return mock_wallet
19 changes: 18 additions & 1 deletion tests/test_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,30 @@
import sys
from openvalidators.neuron import neuron as Neuron
from openvalidators.forward import run_step
from unittest.mock import MagicMock
from unittest.mock import MagicMock, patch

from .helpers import __mock_wallet_factory__

CLI_ARGS_STR = "validators/openvalidators/neuron.py --mock --wallet._mock --wandb.off --neuron.followup_sample_size 10 --neuron.answer_sample_size 10"

SYS_ARGV = sys.argv.copy()


patcher = None

def setUpModule():
"""Runs once for the tests in this module."""
global patcher
patcher = patch("bittensor.wallet.__new__", __mock_wallet_factory__ )
patcher.start()

def tearDownModule():
"""Runs once for the tests in this module."""
global patcher
if patcher:
patcher.stop()


def test_uid_weights_unchanged_unless_queried(n_steps=10, n_concurrent=1):
"""Test that the weights of unqueried uids do not over the course of a forward pass."""

Expand Down