title: "TypeError: can't pickle weakref objects" when pickling a deep learning model
body: <p>When I run</p>
  <pre><code>pickle.dump(model,open('modelDL.pkl','wb'))
  </code></pre>
  <p>I get</p>
  <pre><code>TypeError: can't pickle weakref objects
  </code></pre>
  <p>I have a created a deep learning model which I am trying to save. The model:</p>
  <pre><code>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']) 
  </code></pre>