replace torch with numpy#1777
Merged
sepehr-opentensor merged 1 commit intoopentensor:merge_cudafrom Apr 11, 2024
Merged
Conversation
5747b9b to
2e08ef9
Compare
659d8d9 to
af13847
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 bittensorwill 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_registerandbtcli w faucetcommands 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 bittensorwill not install torch by default - this can be done withpip install bittensor[torch]btcli s pow_registerandbtcli w faucetcommands will fail if torch is not installed.