bittensor icon indicating copy to clipboard operation
bittensor copied to clipboard

Why weight value must be int in hashing weights commit?

Open toilaluan opened this issue 1 year ago • 2 comments

Describe the bug

I faced a error when adding commit/reveal weights to subnet Finally i found that weights must be a list of int, though weights should be a float list sum to 1 as before. This function: https://github.com/opentensor/bittensor/blob/master/bittensor/utils/weight_utils.py#L372

To Reproduce

Run Validator on this PR https://github.com/NicheTensor/NicheImage/pull/75

Expected behavior

/home/ubuntu/miniconda3/envs/main/lib/python3.10/site-packages/bittensor/utils/weight_utils.py:3 │ │ 88 in │ │ │ │ 385 │ │ │ 386 │ vec_values = Vec(data=None, sub_type="U16") │ │ 387 │ vec_values.value = [ │ │ ❱ 388 │ │ U16(ScaleBytes(value.to_bytes(2, "little"))) for value in values │ │ 389 │ ] │ │ 390 │ values = ScaleBytes(vec_values.encode().data) AttributeError: 'float' object has no attribute 'to_bytes'

Screenshots

No response

Environment

Linux Ubuntu

Additional context

No response

toilaluan avatar Jun 18 '24 16:06 toilaluan