From 1a775c69c018b9f2da487ca0b58e7503b9e984c8 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Tue, 4 Jul 2023 21:55:53 -0400 Subject: [PATCH 1/8] add support for 5.3.0 --- openvalidators/neuron.py | 6 +++++- requirements.txt | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/openvalidators/neuron.py b/openvalidators/neuron.py index 227d2c8..5711144 100644 --- a/openvalidators/neuron.py +++ b/openvalidators/neuron.py @@ -84,7 +84,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. diff --git a/requirements.txt b/requirements.txt index 18de33a..f460d67 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -bittensor==5.2.0 +bittensor==5.3.0 transformers<=4.28.0 wandb==0.15.3 datasets==2.12.0 From de734f3c580ab313107b14058759f3e07f7abc81 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Wed, 5 Jul 2023 15:15:01 -0400 Subject: [PATCH 2/8] add requirement for bittensor_wallet --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index f460d67..3afcb0f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ click==8.1.3 torchmetrics sentencepiece numpy==1.21.6 +bittensor_wallet==0.0.2 From 7b0362735f490d9e2046dcc9e5c1e3757ad5f1df Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Wed, 5 Jul 2023 15:15:10 -0400 Subject: [PATCH 3/8] add test helpers --- tests/helpers/__init__.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/helpers/__init__.py diff --git a/tests/helpers/__init__.py b/tests/helpers/__init__.py new file mode 100644 index 0000000..3ceb08d --- /dev/null +++ b/tests/helpers/__init__.py @@ -0,0 +1,25 @@ +# 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 + +def __mock_wallet_factory__(*args, **kwargs) -> _MockWallet: + """Returns a mock wallet object.""" + + mock_wallet = _mock_wallet_utils.get_mock_wallet() + + return mock_wallet \ No newline at end of file From e3a3163c3f6bb18829603c9ca72bb41ce0b1c61b Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Wed, 5 Jul 2023 15:15:21 -0400 Subject: [PATCH 4/8] patch wallet factory --- tests/test_weights.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/test_weights.py b/tests/test_weights.py index 933e6a0..6fb5c6b 100644 --- a/tests/test_weights.py +++ b/tests/test_weights.py @@ -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.""" From b6adb580cc01ee56f0763b8967472c26feb3a2df Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Tue, 11 Jul 2023 17:51:22 -0400 Subject: [PATCH 5/8] bump reqs --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 3afcb0f..edda786 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -bittensor==5.3.0 +bittensor==5.3.1 transformers<=4.28.0 wandb==0.15.3 datasets==2.12.0 @@ -10,4 +10,4 @@ click==8.1.3 torchmetrics sentencepiece numpy==1.21.6 -bittensor_wallet==0.0.2 +bittensor_wallet==0.0.4 From beb5e84e909a556ea4175f93622e3e7b498d918e Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Tue, 11 Jul 2023 17:54:25 -0400 Subject: [PATCH 6/8] fix test helpers --- tests/helpers/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/helpers/__init__.py b/tests/helpers/__init__.py index 3ceb08d..ea6e2eb 100644 --- a/tests/helpers/__init__.py +++ b/tests/helpers/__init__.py @@ -17,9 +17,15 @@ 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 = _mock_wallet_utils.get_mock_wallet() + mock_wallet = _get_mock_wallet() - return mock_wallet \ No newline at end of file + return mock_wallet From af4d0e9231aed240206925f25fcebec49f038141 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Tue, 25 Jul 2023 20:08:25 -0400 Subject: [PATCH 7/8] make reqs looser --- requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index edda786..17d6b03 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -bittensor==5.3.1 -transformers<=4.28.0 +bittensor>=5.3.2,<6.0.0 +transformers<=4.28.0 wandb==0.15.3 datasets==2.12.0 plotly==5.14.1 @@ -10,4 +10,4 @@ click==8.1.3 torchmetrics sentencepiece numpy==1.21.6 -bittensor_wallet==0.0.4 +bittensor_wallet==0.0.5 From bacd9ee54224acd678839be8ceaba71fb2969992 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Wed, 26 Jul 2023 18:35:58 -0400 Subject: [PATCH 8/8] pin below major instead --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 17d6b03..23c892f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,4 +10,4 @@ click==8.1.3 torchmetrics sentencepiece numpy==1.21.6 -bittensor_wallet==0.0.5 +bittensor-wallet>=0.0.4,<1.0.0