optim(rng): Use binarized formats for de/serialization #92
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.
This PR does three things:
.npy
for python and numpy seed keys which works well across versions and we ensure no pickle injections..pt
for torch/CUDA rng and also disable arbitrary pickle injections.neps.runtime
manages it for them16 ==15
issue in Metahyper sampling extra config #42 but I do not know of a concrete reason to have it as high as 1 second.Impact
With the
time.sleep(2)
in theneps_examples/basic_usage/hyperparameters.py
removed, this change resulted in the time going from9.3
seconds to3.9
seconds on my machine. Half of the program duration was spent just serializing and dersializing random stateI'm hoping this also halves the time taken to run the tests, meaning we could just run them all locally instead of having to deal with marked tests.
This is the test file which previously there was no test that serialization actually worked as intended: