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
Use dill for pickling if available. #139
Conversation
@twiecki I would be happy to merge this PR, but I wanted to ask you to do one more thing if you don't mind: could you track down the cPickle call that fails if you need The use case I'm imagining is
Can you remember where to add a hint so that the next user sees a helpful hint instead of hitting (4) ? |
@jaberg Totally agree, I'll make the necessary change. |
@jaberg OK, let me know what you think. I didn't shadow the exception but rather display a log message. |
@twiecki This looks good, but I'm thinking -- doesn't pickling usually fail on the |
@jaberg So actually you can pickle a function call just fine but as it's unpickled it will try to resolve it but can not find the referenced function in the namespace. So we certainly need it there. I can add another check to |
@jaberg OK, added a try/except around dumps too. |
@twiecki Thank you so much! |
Use dill for pickling if available.
@twiecki This branch had |
Oops, sorry about that! unittests apparently didn't choke on that. |
Interesting! Unit tests were meant to run with or without mongo, using On Mon, Jul 15, 2013 at 3:40 PM, Thomas Wiecki notifications@github.comwrote:
|
Hmm, no the logic in the test_mongoexp look OK. I'm guessing what happened On Mon, Jul 15, 2013 at 3:42 PM, James Bergstra james.bergstra@gmail.comwrote:
|
OK, sounds good. |
As described here:
https://github.com/jaberg/hyperopt/issues/131
Passing a non-lambda function to
fmin()
with the mongo backend doesn't work ascPickle
can't pickle functions. Dill, however (https://github.com/uqfoundation/dill) provides a pickle-like interface that makes this possible.To remain backwards compatibility if dill is not installed I implemented a fall-back mechanism.