-
Notifications
You must be signed in to change notification settings - Fork 334
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
add default 1024 max stake limit for querying UIDs with vpermit. #1379
Conversation
ifrit98
commented
Jun 2, 2023
- Small change, make sure that UIDs with a vpermit but under stake limit (1024 by default) are still queried.
@@ -328,12 +329,14 @@ def forward( | |||
# Set `topk` to the number of items in `self.metagraph.n` if `topk` is not provided or is -1. | |||
# Find the available `uids` that are currently serving. | |||
# If `topk` is larger than the number of available `uids`, set `topk` to the number of available `uids`. | |||
available_uids = torch.tensor( [ uid for uid, ax in enumerate( self.metagraph.axons ) if (ax.is_serving) and (not self.metagraph.validator_permit[uid]) ], dtype = torch.int64 ).to( self.device ) | |||
# Check if we have vpermit and if we do, ensure query only UIDs with less than vpermit_tao_limit. | |||
candidate_uids = [uid for uid, ax in enumerate(self.metagraph.axons) if ax.is_serving and ((self.metagraph.validator_permit[uid] and self.metagraph.S[uid] < self.config.neuron.vpermit_tao_limit) or not self.metagraph.validator_permit[uid])] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition should also be updated in check_weights
.
Can also be simplified to not self.metagraph.validator_permit[uid] or self.metagraph.S[uid] < self.config.neuron.vpermit_tao_limit
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assume it would be as simple as changing the 2nd if condition in check_weights
to:
for uid, hotkey in enumerate( self.hotkeys ):
if hotkey != self.metagraph.hotkeys[ uid ]:
self.moving_averaged_scores[ uid ] = 0 #hotkey has been replaced
if self.metagraph.validator_permit[ uid ] and self.metagraph.S[ uid ] < self.config.neuron.vpermit_tao_limit:
self.moving_averaged_scores[ uid ] = 0 # hotkey has validation rights and is below the tao limit
Let me know if this is an incorrect assumption.