Untitled
unknown
plain_text
5 months ago
2.1 kB
2
Indexable
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[18], line 7 4 print(X_test[i].shape[1]) 6 input_signature = [tf.TensorSpec([1, 128, 259, 1], tf.float32, name='input')] ----> 7 onnx_model, _ = tf2onnx.convert.from_keras(model,input_signature,opset=13) 8 onnx.save(onnx_model,"converted_model.onnx") File /opt/conda/lib/python3.10/site-packages/tf2onnx/convert.py:442, in from_keras(model, input_signature, opset, custom_ops, custom_op_handlers, custom_rewriter, inputs_as_nchw, outputs_as_nchw, extra_opset, shape_override, target, large_model, output_path, optimizers) 438 if get_tf_version() < Version("2.0"): 439 return _from_keras_tf1(model, opset, custom_ops, custom_op_handlers, custom_rewriter, inputs_as_nchw, 440 outputs_as_nchw, extra_opset, shape_override, target, large_model, output_path) --> 442 old_out_names = _rename_duplicate_keras_model_names(model) 443 from tensorflow.python.keras.saving import saving_utils as _saving_utils # pylint: disable=import-outside-toplevel 445 # let tensorflow do the checking if model is a valid model File /opt/conda/lib/python3.10/site-packages/tf2onnx/convert.py:331, in _rename_duplicate_keras_model_names(model) 325 """ 326 In very rare cases, keras has a bug where it will give multiple outputs the same name. 327 We must edit the model or the TF trace will fail. Returns old_out_names (or None if no edit was made). 328 IMPORTANT: model may be edited. Assign model.output_names to old_out_names to restore. 329 """ 330 old_out_names = None --> 331 if model.output_names and len(set(model.output_names)) != len(model.output_names): 332 # In very rare cases, keras has a bug where it will give multiple outputs the same name 333 # We must edit the model or the TF trace will fail 334 old_out_names = model.output_names 335 used_names = set() AttributeError: 'Sequential' object has no attribute 'output_names'
Editor is loading...
Leave a Comment