fix PoW and other functions not working with USE_TORCH=0 despite torch being available#1917
Conversation
85cdc00 to
db3ef49
Compare
| U16_MAX = 65535 | ||
|
|
||
|
|
||
| @legacy_torch_api_compat |
There was a problem hiding this comment.
IMO this approach of just having one implementation of a function and then translating only input and output will be much easier to maintain, but I leave it to others if they want to use it in more places or if they want to keep using if use_torch() all over the place
…h being available
db3ef49 to
bb758b3
Compare
|
@thewhaleking as author of #1904 you maybe interested in this PR @gus-opentensor this probably should also land in v7, as it will make users less reluctant to switch to numpy interface |
thewhaleking
left a comment
There was a problem hiding this comment.
This overall looks good to me.
bittensor/utils/registration.py
Outdated
| def __init__(self): | ||
| self._transformed = False | ||
| def legacy_torch_api_compat(func): | ||
| """Decorator to convert numpy arrays to torch tensors before passing them to the function. |
There was a problem hiding this comment.
I really like this approach. I would recommend updating this line, as it reads as the opposite of what it's saying. Other than that, this seems great.
fix PoW and other functions not working with USE_TORCH=0 despite torch being available
Bug
This fixes problem that after #1904 uses wanting PoW and other torch-using functionality were forced to use USE_TORCH=1 which also forced the legacy torch-based interface.
Description of the Change
USE_TORCH=0, so users don't accidentally run legacy interface - we want old users to move to new one as soon as it is viable AND none of the new users should accidentally run legacy interfacelegacy_torch_api_compatfor an easier way of maintaining two interfaces, but only used it in limited fashion for nowAlternate Designs
as written above, no
Possible Drawbacks
No real drawbacks that Im aware of.
Verification Process
Unit tests added and manual tests.
Release Notes
None, this fixes regression introduced by #1904 that was yet to be released.