solve issue #542. fix pickle.UnpickingError while blendsearch warm start #554
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.
Issue I encountered:
#542 run test_restore.py and got _pickle.UnpicklingError: state is not a dictionary
I observed:
numpy version
i. When numpy==1.16*, np.random.RandomState.getstate() returns a tuple, not a dict.
_pickle.UnpicklingError occurs
ii. When numpy>1.17.0rc1, it returns a dict;
_pickle.UnpicklingError does not occur
iii. When numpy>1.17.0rc1, flaml uses np_random_generator = np.random.Generator,
_pickle.UnpicklingError does not occur
class _BackwardsCompatibleNumpyRng
When I remove func _BackwardsCompatibleNumpyRng.getattr() , _pickle.UnpicklingError doesn't occur (regardless of numpy version == 1.16* or 1.17*)
To sum up,
I think making modifications to class _BackwardsCompatibleNumpyRng is not a good choice (_BackwardsCompatibleNumpyRng came from ray)and we still need to learn more about the operation mechanism of pickle.
So I upgraded the numpy version that flaml requires:
setup.py:"NumPy>=1.17.0rc1"