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 of the Change
Replaced torch with numpy through the codebase, except places where torch is needed.
By default
pip install bittensor
will not install torch.Torch is now an optional dependency which can be installed alongside bittensor by specifying the
[torch]
extra flag.Quantitative Performance Benefits
pip install bittensor[torch]
(with cuda) takes up 5.5GB, whilepip install bittensor
(numpy only) takes up 680M and it's faster (for instance from 62s to 24s on my machine with all wheels cached)Caveats
Commands which require torch will print an error message prompting the user to install torch if the package is missing.
CLI users upgrading bittensor and having torch available should not be affected - all commands will work the same.
Users installing bittensor from scratch and attempting to register will need the torch package.
btcli s pow_register
andbtcli w faucet
commands will explicitly prompt the user to install torch.Library users would have to deal with the changes from torch to numpy (primary affecting the metagraph data). The migration is straightforward, see common replacements:
Verification Process
Installed it with and without [torch] in fresh venvs and manually tested btcli commands.
Tested on compute horde staging miner and validator.
Applicable Issues
Release Notes
pip install bittensor
will not install torch by default - this can be done withpip install bittensor[torch]
btcli s pow_register
andbtcli w faucet
commands will fail if torch is not installed.