fix can_commit to use get_weights_set_rate_limit #540
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Previously, the can_commit function checked to see if a whole commit_reveal_weights_interval has passed before being allowed to commit weights again. Instead, we should keep this logic for when we can reveal_weights (as is intended), but the neuron should be able to commit weights multiple times within a single commit_reveal_weights_interval according to the weights_rate_limit hyperparameter. If not, the weights_rate_limit is essentually useless because the can_commit function overrides the weights_rate_limit.
Furthermore, it introduces an edge case where if commit_reveal_weights_interval if > activity_cutoff, all weights go away and the network stalls because neurons are now setting weights > once per activity_cutoff. This PR fixes this too.
Type of Change
Checklist
cargo fmt
andcargo clippy
to ensure my code is formatted and linted correctlyScreenshots (if applicable)
Please include any relevant screenshots or GIFs that demonstrate the changes made.
Additional Notes
Please provide any additional information or context that may be helpful for reviewers.