keras-tqdm icon indicating copy to clipboard operation
keras-tqdm copied to clipboard

can't deepcopy TQDMCallback object

Open phausamann opened this issue 8 years ago • 3 comments

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?

phausamann avatar Aug 10 '17 15:08 phausamann

@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

bstriner avatar Aug 10 '17 21:08 bstriner

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.

phausamann avatar Aug 11 '17 09:08 phausamann

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

bytearchive avatar Nov 22 '22 04:11 bytearchive