When I run
pickle.dump(model,open('modelDL.pkl','wb'))
I get
TypeError: can't pickle weakref objects
I have a created a deep learning model which I am trying to save. The model:
model = Sequential()
model.add( Dense(30,activation='relu') )
model.add( Dropout(0.5) )
model.add( Dense(20,activation='relu') )
model.add( Dropout(0.5) )
model.add( Dense(20,activation='relu') )
model.add( Dropout(0.5) )
model.add( Dense(1,activation='sigmoid') )
model.compile(optimizer='adam',loss='binary_crossentropy',metrics=['accuracy'])
SavedModel
andHDF5
). The TensorFlowSavedModel
format is the default file format inTF2.x
. However, models can be saved inHDF5
format. InTF1.x
it defaults toHDF5
.Thanks!