Closed alireza-akhondi-asl closed 5 years ago
This originates because unpickling class instances does something similar to
def load(cls, attributes):
obj = cls.__new__(cls)
obj.__dict__.update(attributes)
return obj
where here, cls
is IntCatHyperParameter
. This uses the default parameter values in HyperParameter.__new__
of param_type=None
which is invalid.
Smaller test case:
import pickle
from btb import HyperParameter
param = HyperParameter('int', [0, 1])
with open('/tmp/param.pkl', 'wb') as f:
pickle.dump(param, f, pickle.HIGHEST_PROTOCOL)
with open('/tmp/param.pkl', 'rb') as f:
pickle.load(f)
Note that the error does not occur when using the default pickling protocol (0
) rather than pickle.HIGHEST_PROTOCOL
.
Thank you!
Description
I would like to save and load the tuner objects using pickle. However, when I try to load the saved object I get an error message:
What I Did