{"action":"created","issue":{"url":"https://api.github.com/repos/jarfo/kchar/issues/8","repository_url":"https://api.github.com/repos/jarfo/kchar","labels_url":"https://api.github.com/repos/jarfo/kchar/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/jarfo/kchar/issues/8/comments","events_url":"https://api.github.com/repos/jarfo/kchar/issues/8/events","html_url":"https://github.com/jarfo/kchar/issues/8","id":241694909,"node_id":"MDU6SXNzdWUyNDE2OTQ5MDk=","number":8,"title":"'--skip_train' ValueError: ('Could not interpret optimizer identifier:', <class 'keras.optimizers.SGD'>)","user":{"login":"jingweimo","id":18681637,"node_id":"MDQ6VXNlcjE4NjgxNjM3","avatar_url":"https://avatars3.githubusercontent.com/u/18681637?v=4","gravatar_id":"","url":"https://api.github.com/users/jingweimo","html_url":"https://github.com/jingweimo","followers_url":"https://api.github.com/users/jingweimo/followers","following_url":"https://api.github.com/users/jingweimo/following{/other_user}","gists_url":"https://api.github.com/users/jingweimo/gists{/gist_id}","starred_url":"https://api.github.com/users/jingweimo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jingweimo/subscriptions","organizations_url":"https://api.github.com/users/jingweimo/orgs","repos_url":"https://api.github.com/users/jingweimo/repos","events_url":"https://api.github.com/users/jingweimo/events{/privacy}","received_events_url":"https://api.github.com/users/jingweimo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-07-10T12:26:12Z","updated_at":"2018-07-23T08:40:45Z","closed_at":"2018-01-25T09:19:18Z","author_association":"NONE","body":"For a quick test, I first test on a small model by running the code:\r\n`python train_lstm3.py --rnn_size 50 --highway_layer 1 --feature_maps 5 10 15 20 25 30 --kernels 1 2 3 4 5 6 --checkpoint_dir LSTM4 --savefile char-small --max_epochs 1`\r\n\r\nIt gives the results:\r\nEpoch 1/1\r\n1327/1327 [==============================] - 2175s - loss: 6.6535\r\nEpoch 1/1. Validation loss: 708.149629583\r\nPerplexity on test set:  672.399581347\r\n\r\n\r\nWith the trained model, I perform evaluation on the test again by running the codes:\r\n`python train_lstm3.py --rnn_size 50 --highway_layer 1 --feature_maps 5 10 15 20 25 30 --kernels 1 2 3 4 5 6 --checkpoint_dir LSTM4 --savefile char-small --max_epochs 1 --skip_train`\r\n\r\nBut it gives the error message:\r\n`C:\\Users\\jingweimo\\Anaconda2\\lib\\site-packages\\keras\\legacy\\layers.py:654: UserWarning: The `Highway` layer is deprecated and will be removed after 06/2017.\r\n  warnings.warn('The `Highway` layer is deprecated '\r\n\r\nTraceback (most recent call last):\r\n  File \"train.py\", line 114, in <module>\r\n    main(params)\r\n  File \"train.py\", line 46, in main\r\n    model = load_model('{}/{}.json'.format(opt.checkpoint_dir, opt.savefile))\r\n  File \"D:\\LSTM packages\\kchar-master\\kchar-master\\model\\LSTMCNN.py\", line 190, in load_model\r\n    model.compile(loss='sparse_categorical_crossentropy', optimizer=SGD)\r\n  File \"C:\\Users\\jingweimo\\Anaconda2\\lib\\site-packages\\keras\\engine\\training.py\", line 720, in compile\r\n    self.optimizer = optimizers.get(optimizer)\r\n  File \"C:\\Users\\jingweimo\\Anaconda2\\lib\\site-packages\\keras\\optimizers.py\", line 710, in get\r\n    identifier)\r\nValueError: ('Could not interpret optimizer identifier:', <class 'keras.optimizers.SGD'>)`\r\n\r\nIt seems there is something wrong with `load_model` in `LSTMCNN.py`.  I feel you may need to change \r\n`model.compile(loss='sparse_categorical_crossentropy', optimizer=SGD)`\r\nto\r\n`model.compile(loss='sparse_categorical_crossentropy', optimizer=SGD())`\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/jarfo/kchar/issues/comments/406983592","html_url":"https://github.com/jarfo/kchar/issues/8#issuecomment-406983592","issue_url":"https://api.github.com/repos/jarfo/kchar/issues/8","id":406983592,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjk4MzU5Mg==","user":{"login":"priyanka-chaudhary","id":16559928,"node_id":"MDQ6VXNlcjE2NTU5OTI4","avatar_url":"https://avatars1.githubusercontent.com/u/16559928?v=4","gravatar_id":"","url":"https://api.github.com/users/priyanka-chaudhary","html_url":"https://github.com/priyanka-chaudhary","followers_url":"https://api.github.com/users/priyanka-chaudhary/followers","following_url":"https://api.github.com/users/priyanka-chaudhary/following{/other_user}","gists_url":"https://api.github.com/users/priyanka-chaudhary/gists{/gist_id}","starred_url":"https://api.github.com/users/priyanka-chaudhary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/priyanka-chaudhary/subscriptions","organizations_url":"https://api.github.com/users/priyanka-chaudhary/orgs","repos_url":"https://api.github.com/users/priyanka-chaudhary/repos","events_url":"https://api.github.com/users/priyanka-chaudhary/events{/privacy}","received_events_url":"https://api.github.com/users/priyanka-chaudhary/received_events","type":"User","site_admin":false},"created_at":"2018-07-23T08:40:45Z","updated_at":"2018-07-23T08:40:45Z","author_association":"NONE","body":"@gracecxj : My problem was similar to this and see my comment for answer\r\nhttps://stackoverflow.com/questions/50056356/could-not-interpret-optimizer-identifier-error-in-keras/50066670#50066670"}}
{"actor":{"display_login":"priyanka-chaudhary"}}