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

Hotfix/refresh metagraph #517

Merged
merged 5 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion .env.api.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ API_PORT = "42170" # Port for the API server
API_HOST = "0.0.0.0" # Host for the API server
SCORING_KEY = "123" # The scoring key for the validator (must match the scoring key in the .env.validator file)
SCORE_ORGANICS = True # Whether to score organics
VALIDATOR_API = "0.0.0.0:8094" # The validator API to forward responses to for scoring
VALIDATOR_API = "0.0.0.0:8094" # The validator API to forward responses to for scoring
2 changes: 1 addition & 1 deletion api_keys.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
7 changes: 4 additions & 3 deletions prompting/weight_setting/weight_setter.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ class Config:

async def start(self, reward_events):
self.reward_events = reward_events
self.subtensor = bt.Subtensor(network=shared_settings.SUBTENSOR_NETWORK)
self.metagraph = self.subtensor.metagraph(netuid=shared_settings.NETUID)
global PAST_WEIGHTS

try:
Expand Down Expand Up @@ -239,8 +237,11 @@ async def run_step(self):
except Exception as ex:
logger.exception(f"{ex}")
# set weights on chain
set_weights(final_rewards, step=self.step, subtensor=self.subtensor, metagraph=self.metagraph)
set_weights(
final_rewards, step=self.step, subtensor=shared_settings.SUBTENSOR, metagraph=shared_settings.METAGRAPH
)
self.reward_events = [] # empty reward events queue
shared_settings.refresh_metagraph()
await asyncio.sleep(0.01)
return final_rewards

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "prompting"
version = "2.15.2"
version = "2.15.3"
description = "Subnetwork 1 runs on Bittensor and is maintained by Macrocosmos. It's an effort to create decentralised AI"
authors = ["Kalei Brady, Dmytro Bobrenko, Felix Quinque, Steffen Cruz, Richard Wardle"]
readme = "README.md"
Expand Down
6 changes: 6 additions & 0 deletions shared/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,12 @@ def METAGRAPH(self) -> bt.metagraph:
logger.info(f"Instantiating metagraph with NETUID: {self.NETUID}")
return self.SUBTENSOR.metagraph(netuid=self.NETUID)

def refresh_metagraph(self) -> bt.metagraph:
# Drop the cached property so it will be recomputed
if "METAGRAPH" in self.__dict__:
del self.__dict__["METAGRAPH"]
return self.METAGRAPH

@cached_property
def DENDRITE(self) -> bt.dendrite:
logger.info(f"Instantiating dendrite with wallet: {self.WALLET}")
Expand Down
Loading