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

solve issue #542. fix pickle.UnpickingError while blendsearch warm start #554

Merged
merged 5 commits into from
May 23, 2022

Conversation

LinWencong
Copy link
Contributor

Issue I encountered:

#542 run test_restore.py and got _pickle.UnpicklingError: state is not a dictionary

I observed:

  1. 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

  2. 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"

…h warm start

Issue I encountered:

microsoft#542 run test_restore.py and got _pickle.UnpicklingError: state is not a dictionary

I observed:

1. 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

2. 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"
@LinWencong
Copy link
Contributor Author

There is a stack overflow error on the window 2019 python3.8 test pipeline. I guess rerun the pipeline might fix the problem.

@sonichi sonichi requested a review from qingyun-wu May 19, 2022 22:51
@sonichi
Copy link
Collaborator

sonichi commented May 20, 2022

Requesting review from @skzhang1 @MichalChromcak for the version update in conda package.
Is it better to put a stable version for numpy instead of rc1?

@skzhang1
Copy link
Collaborator

skzhang1 commented May 22, 2022

I run test_restore.py. It runs well if upgrade numpy version. It seems no problem to me.
I have created a PR to update conda package

@sonichi sonichi merged commit 515a77a into microsoft:main May 23, 2022
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.

run test_restore.py and got _pickle.UnpicklingError: state is not a dictionary
3 participants