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

process_weights_for_netuid breaks when there is only 1 non-zero weight #93

Open
dylanuys opened this issue Jun 6, 2024 · 0 comments · May be fixed by #103
Open

process_weights_for_netuid breaks when there is only 1 non-zero weight #93

dylanuys opened this issue Jun 6, 2024 · 0 comments · May be fixed by #103

Comments

@dylanuys
Copy link

dylanuys commented Jun 6, 2024

Edge case in weight setting that only occurs when there's a single non-zero weight:

  • In weight_utils.process_weights_for_netuid , non-zero weight indices are extracted by calling np.argwhere(weights > 0).squeeze(). (line 142)
    • In the case where there is only a single weight with a non-zero value, this returns an array scalar (which is an unsized object, i.e. you cannot call len on it).
  • The resulting variable non_zero_weight_idx is used to index into uids and weights, which again produces an array scaler (lines 143-144)
  • Downstream code calls len on non_zero_weights, which fails in the case of it being an array scaler (line 168)

Toy recreation of the issue:
Screenshot 2024-06-06 at 2 40 15 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant