Skip to content

Commit

Permalink
Increase the weight setting epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
bkb2135 committed Dec 29, 2024
1 parent 2ddcf8f commit 59ec211
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
8 changes: 3 additions & 5 deletions prompting/weight_setting/weight_setter.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class WeightSetter(AsyncLoopRunner):
"""The weight setter looks at RewardEvents in the reward_events queue and sets the weights of the miners accordingly."""

sync: bool = True
interval: int = 60 * 22 # set rewards every 20 minutes
interval: int = 60 * 25 # set rewards every 25 minutes
reward_events: list[list[WeightedRewardEvent]] | None = None
subtensor: bt.Subtensor | None = None
metagraph: bt.Metagraph | None = None
Expand Down Expand Up @@ -240,10 +240,8 @@ async def run_step(self):
set_weights(
final_rewards, step=self.step, subtensor=shared_settings.SUBTENSOR, metagraph=shared_settings.METAGRAPH
)
self.reward_events = [] # empty reward events queue
logger.debug(f"Pre-Refresh Metagraph Block: {shared_settings.METAGRAPH.block}")
shared_settings.refresh_metagraph()
logger.debug(f"Post-Refresh Metagraph Block: {shared_settings.METAGRAPH.block}")
#TODO: empty rewards queue only on weight setting success
self.reward_events[:] = [] # empty reward events queue
await asyncio.sleep(0.01)
return final_rewards

Expand Down
9 changes: 1 addition & 8 deletions shared/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class SharedSettings(BaseSettings):
NEURON_GPUS: int = Field(1, env="NEURON_GPUS")

# Logging.
LOGGING_DONT_SAVE_EVENTS: bool = Field(False, env="LOGGING_DONT_SAVE_EVENTS")
LOGGING_DONT_SAVE_EVENTS: bool = Field(True, env="LOGGING_DONT_SAVE_EVENTS")
LOG_WEIGHTS: bool = Field(False, env="LOG_WEIGHTS")

# Neuron parameters.
Expand Down Expand Up @@ -250,13 +250,6 @@ 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:
logger.debug("Refreshing metagraph")
if "METAGRAPH" in self.__dict__:
del self.__dict__["METAGRAPH"]
logger.debug("Deleting cached metagraph")
return self.METAGRAPH

@cached_property
def UID(self) -> int:
return self.METAGRAPH.hotkeys.index(self.WALLET.hotkey.ss58_address)
Expand Down

0 comments on commit 59ec211

Please sign in to comment.