{"action":"opened","issue":{"url":"https://api.github.com/repos/onnx/tutorials/issues/145","repository_url":"https://api.github.com/repos/onnx/tutorials","labels_url":"https://api.github.com/repos/onnx/tutorials/issues/145/labels{/name}","comments_url":"https://api.github.com/repos/onnx/tutorials/issues/145/comments","events_url":"https://api.github.com/repos/onnx/tutorials/issues/145/events","html_url":"https://github.com/onnx/tutorials/issues/145","id":485781271,"node_id":"MDU6SXNzdWU0ODU3ODEyNzE=","number":145,"title":"Problem with onnxmltools.convert_keras using Models with Custom layer","user":{"login":"shabnamrashtchi","id":49405066,"node_id":"MDQ6VXNlcjQ5NDA1MDY2","avatar_url":"https://avatars1.githubusercontent.com/u/49405066?v=4","gravatar_id":"","url":"https://api.github.com/users/shabnamrashtchi","html_url":"https://github.com/shabnamrashtchi","followers_url":"https://api.github.com/users/shabnamrashtchi/followers","following_url":"https://api.github.com/users/shabnamrashtchi/following{/other_user}","gists_url":"https://api.github.com/users/shabnamrashtchi/gists{/gist_id}","starred_url":"https://api.github.com/users/shabnamrashtchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shabnamrashtchi/subscriptions","organizations_url":"https://api.github.com/users/shabnamrashtchi/orgs","repos_url":"https://api.github.com/users/shabnamrashtchi/repos","events_url":"https://api.github.com/users/shabnamrashtchi/events{/privacy}","received_events_url":"https://api.github.com/users/shabnamrashtchi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-08-27T12:32:00Z","updated_at":"2019-08-27T12:32:00Z","closed_at":null,"author_association":"NONE","body":"Hi \r\nI am trying to **convert my Keras model to ONNX.**\r\nMy model is Bidirectional LSTM with Self Attention layer. Attention class is a custom layer I developed for my Keas model. \r\nWhen I try to covert the model to ONNX I face the following error: \r\nI tried a few options: \r\n# loading keras model first: \r\n# AttentionLayer is the name of my class ( developed layer)\r\nbest_model = load_model( 'model.h5', custom_objects={'AttentionLayer': AttentionLayer})\r\n\r\nonnx_model = onnxmltools.convert_keras(best_model, best_model.name)\r\n# or \r\nimport keras2onnx\r\nonnx_model = keras2onnx.convert_keras(model, model.name\r\n                                      , target_opset=7,\r\n                                      debug_mode=False)\r\n\r\n# or \r\nonnx.save(onnx_model, 'model.onnx')"}}
{"actor":{"display_login":"shabnamrashtchi"}}