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

Dynamically import compression module in compressors.py #1

Merged
merged 2 commits into from
Jul 19, 2023

Conversation

congruency
Copy link
Contributor

Let the example adapt to any compression algorithm (that conforms to spec) by importing the module under an exception handler.

Example using zstd, which is not found in the original compressors.py

root@b06f53bafe18:/workspace# python main_text.py --compressor gzip
400
400
KNN with compressor=gzip
400it [00:07, 50.78it/s]
Accuracy is 0.6875
spent: 7.89499568939209
root@b06f53bafe18:/workspace# python main_text.py --compressor zstd
400
400
KNN with compressor=zstd
400it [00:02, 172.99it/s]
Accuracy is 0.7375
spent: 2.3285083770751953

Let the example adapt to any compression algorithm that conforms by importing the module under an exception handler.
Replace ImportError with ModuleNotFoundError
@Briancarl07
Copy link

Nice

Copy link
Collaborator

@zbloss zbloss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@bazingagin bazingagin merged commit 04ef78d into bazingagin:main Jul 19, 2023
@congruency congruency deleted the dynimport branch July 21, 2023 18:45
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 this pull request may close these issues.

4 participants