Can't save custom subclassed model

前端 未结 5 1119
失恋的感觉
失恋的感觉 2020-12-13 19:01

Inspired by tf.keras.Model subclassing I created custom model.
I can train it and get successfull results, but I can\'t save it.
I use python3.6 wit

5条回答
  •  半阙折子戏
    2020-12-13 19:47

    This will be fixed in an upcoming release according to the 1.13 pre-release patch notes:

    • Keras & Python API:
      • Subclassed Keras models can now be saved through tf.contrib.saved_model.save_keras_model.

    EDIT: It seems this is not quite as finished as the notes suggest. The docs for that function for v1.13 state:

    Model limitations: - Sequential and functional models can always be saved. - Subclassed models can only be saved when serving_only=True. This is due to the current implementation copying the model in order to export the training and evaluation graphs. Because the topology of subclassed models cannot be determined, the subclassed models cannot be cloned. Subclassed models will be entirely exportable in the future.

提交回复
热议问题