You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't figure out how to get back a model from an AutoQKeras search in one script, when in another script. I tried to use qmodel.save('qmodel') and qmodel = load_qmodel('qmodel'), but I get these errors.
Traceback (most recent call last):
File "code/auto_qkeras.py", line 578, in <module>
aqk_model = load_qmodel('qmodel')
File "/home/berian/.local/lib/python3.8/site-packages/qkeras/utils.py", line 928, in load_qmodel
qmodel = tf.keras.models.load_model(filepath, custom_objects=custom_objects,
File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/usr/local/lib/python3.8/dist-packages/keras/saving/saved_model/load.py", line 1008, in revive_custom_object
raise ValueError(
ValueError: Unable to restore custom object of type _tf_keras_metric. Please make sure that any custom layers are included in the `custom_objects` arg when calling `load_model()` and make sure that all layers implement `get_config` and `from_config`.
Following the AutoQKeras guide https://github.com/google/qkeras/blob/master/notebook/AutoQKeras.ipynb, there is an example for saving/loading weights into a QKeras model object. However, I won't have the model object from the AutoQKeras searchin a different script, so using qmodel.load_weights("qmodel.h5") is not feasible. I have also noticed that when I make my own QKeras model object, qmodel.save(...) and qmodel = load_qmodel(...) work just fine.
Maybe there are some extra options I need to add to theload_qmodel(...) function? Or is there a better way altogether to transfer qmodel the object from one script to another?
The text was updated successfully, but these errors were encountered:
I can't figure out how to get back a model from an AutoQKeras search in one script, when in another script. I tried to use
qmodel.save('qmodel')
andqmodel = load_qmodel('qmodel')
, but I get these errors.Following the AutoQKeras guide https://github.com/google/qkeras/blob/master/notebook/AutoQKeras.ipynb, there is an example for saving/loading weights into a QKeras model object. However, I won't have the model object from the AutoQKeras searchin a different script, so using
qmodel.load_weights("qmodel.h5")
is not feasible. I have also noticed that when I make my own QKeras model object,qmodel.save(...)
andqmodel = load_qmodel(...)
work just fine.Maybe there are some extra options I need to add to the
load_qmodel(...)
function? Or is there a better way altogether to transfer qmodel the object from one script to another?The text was updated successfully, but these errors were encountered: