Cannot serialize Queue
See original GitHub issueThe following code works with bayesian-optimization==1.2.0
, but fails with bayesian-optimization==1.3.0
(or the latest one).
import ray
from ray import tune
from ray.tune.search import ConcurrencyLimiter
from ray.tune.search.bayesopt import BayesOptSearch
def scoreFn(config):
print(config)
tune.report(
ret=config['x'] * 1.2 + config['y'] * 1.2
)
bo = BayesOptSearch(
space={
'x': (0.2, 0.95),
'y': (0.5, 2.5),
},
metric='ret',
mode='min',
)
tuner = tune.Tuner(
scoreFn,
tune_config=tune.TuneConfig(
num_samples=24,
search_alg=ConcurrencyLimiter(bo, max_concurrent=4),
),
)
results = tuner.fit()
The error in bayesian-optimization==1.3.0
:
Traceback (most recent call last):
File "/run/media/adam/Data/search_bo.py", line 38, in <module>
tuner = tune.Tuner(
File "/run/media/adam/Data/venv-py310/lib/python3.10/site-packages/ray/tune/tuner.py", line 152, in __init__
self._local_tuner = TunerInternal(**kwargs)
File "/run/media/adam/Data/venv-py310/lib/python3.10/site-packages/ray/tune/impl/tuner_internal.py", line 123, in __init__
pickle.dump(self, fp)
File "/run/media/adam/Data/venv-py310/lib/python3.10/site-packages/ray/cloudpickle/cloudpickle_fast.py", line 57, in dump
).dump(obj)
File "/run/media/adam/Data/venv-py310/lib/python3.10/site-packages/ray/cloudpickle/cloudpickle_fast.py", line 627, in dump
return Pickler.dump(self, obj)
TypeError: cannot pickle '_thread.lock' object
After bisecting, the code works if I revert commit 8cc8d9b. A quick fix would be reverting that commit in the master branch.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6
Top Results From Across the Web
In C#, How can I serialize Queue<>? (.Net 2.0)
A queue is pretty trivial to implement. You can easily create your own that also implements IList so that it will be serializable....
Read more >[MySQL] Queuing database migration gives me "You ...
You cannot serialize or unserialize PDO instances. Comming from src\Illuminate\Queue\Queue.php:139 . This is my configuration:.
Read more >Unable to De-Serialize Encrypted Generic Queue - MSDN
I think the problem must be that I can not serialize a collection. Is there any way to serialize a collection, like in...
Read more >Cannot serialize the DataTable - Studio
Hello Team, I'm creating a orchestration process, after adding items to the queue, while creating task based on transaction item getting ...
Read more >You cannot serialize or unserialize PDO instances
You need to find the place where you are serializing a pdo instance. Perhaps you are sending a connection or similar to a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK @chengscott - I think may ray issues were I started with python 3.11 which wouldn’t install ray at all, then I went to 3.6 which installed but but must have been 1.x. With 3.10 it worked fine.
I’ve done what you suggested and reverted back to the old Queue implementation. I have also added a test based on @cosmicBboy’s code to ensure that the the BayesianOptimization can be serialized. I will release this under 1.3.1 shortly.
can confirm this issue comes up when trying to pickle the
BayesianOptimization
object: