bstriner / keras-tqdm

Keras integration with TQDM progress bars
MIT License
348 stars 41 forks source link

can't deepcopy TQDMCallback object #17

Open phausamann opened 7 years ago

phausamann commented 7 years ago

from keras_tqdm import TQDMCallback from copy import deepcopy deepcopy(TQDMCallback())

doesn't work because stderr can't be pickled.

A quick fix is to set output_file=None. Maybe this should be the default?

bstriner commented 7 years ago

@phausamann Interesting catch. Should be easy enough to fix if None means stderr.

Just curious, why are you trying to deepcopy the callback? It is part of training, not part of the model itself, so you would normally just create it whenever you train.

Cheers

phausamann commented 7 years ago

I use it inside of a KerasClassifier/KerasEstimator wrapper in a scikit-learn pipeline. scikit-learn expects that it is able to set all parameters of the fit method in the constructor of the estimator, i.e. including the callbacks. The keras wrapper deepcopies all of the parameters when fit is called.

It is possible to pass the callback only when calling fit, but in my case it is a lot more convenient to do it when I create the estimator object.

bytearchive commented 1 year ago

I am getting this ValueError: All callbacks used during a search should be deep-copyable due to not able to deepcopy the callback