Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
Showing results for 
Search instead for 
Did you mean: 

How to set sparkTrials? I am receiving this TypeError: cannot pickle '_thread.lock' object

New Contributor III

Hey Sara, this Somayeh from VINN Automotive.

As I had already shared with you, I am trying to distribute hyperparameter tuning using hyperopt on a tensorflow.keras model. I am using sparkTrials in my fmin:

spark_trials = SparkTrials(parallelism=4)


best_hyperparam = fmin(fn=CNN_HOF, 





but I am receiving this error:

TypeError: cannot pickle '_thread.lock' object

the only way the code is working is skipping the trials passing by commenting out the line trials=spark_trials which means there would be no distributed tuning.

I went through the resources you shared, but couldn't find anything working for me though. Any idea how can I fix this?

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!