{"action":"closed","issue":{"url":"https://api.github.com/repos/NTMC-Community/MatchZoo/issues/465","repository_url":"https://api.github.com/repos/NTMC-Community/MatchZoo","labels_url":"https://api.github.com/repos/NTMC-Community/MatchZoo/issues/465/labels{/name}","comments_url":"https://api.github.com/repos/NTMC-Community/MatchZoo/issues/465/comments","events_url":"https://api.github.com/repos/NTMC-Community/MatchZoo/issues/465/events","html_url":"https://github.com/NTMC-Community/MatchZoo/issues/465","id":377359880,"node_id":"MDU6SXNzdWUzNzczNTk4ODA=","number":465,"title":"DSSMPreprocessor Error After Loading","user":{"login":"fthbrmnby","id":11162586,"node_id":"MDQ6VXNlcjExMTYyNTg2","avatar_url":"https://avatars0.githubusercontent.com/u/11162586?v=4","gravatar_id":"","url":"https://api.github.com/users/fthbrmnby","html_url":"https://github.com/fthbrmnby","followers_url":"https://api.github.com/users/fthbrmnby/followers","following_url":"https://api.github.com/users/fthbrmnby/following{/other_user}","gists_url":"https://api.github.com/users/fthbrmnby/gists{/gist_id}","starred_url":"https://api.github.com/users/fthbrmnby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fthbrmnby/subscriptions","organizations_url":"https://api.github.com/users/fthbrmnby/orgs","repos_url":"https://api.github.com/users/fthbrmnby/repos","events_url":"https://api.github.com/users/fthbrmnby/events{/privacy}","received_events_url":"https://api.github.com/users/fthbrmnby/received_events","type":"User","site_admin":false},"labels":[{"id":946398538,"node_id":"MDU6TGFiZWw5NDYzOTg1Mzg=","url":"https://api.github.com/repos/NTMC-Community/MatchZoo/labels/2.0","name":"2.0","color":"0ebff9","default":false},{"id":622313089,"node_id":"MDU6TGFiZWw2MjIzMTMwODk=","url":"https://api.github.com/repos/NTMC-Community/MatchZoo/labels/bug","name":"bug","color":"ee0701","default":true},{"id":1091539073,"node_id":"MDU6TGFiZWwxMDkxNTM5MDcz","url":"https://api.github.com/repos/NTMC-Community/MatchZoo/labels/question%20on%20matchzoo%202.0","name":"question on matchzoo 2.0","color":"bf1c52","default":false}],"state":"closed","locked":false,"assignee":{"login":"uduse","id":4717005,"node_id":"MDQ6VXNlcjQ3MTcwMDU=","avatar_url":"https://avatars2.githubusercontent.com/u/4717005?v=4","gravatar_id":"","url":"https://api.github.com/users/uduse","html_url":"https://github.com/uduse","followers_url":"https://api.github.com/users/uduse/followers","following_url":"https://api.github.com/users/uduse/following{/other_user}","gists_url":"https://api.github.com/users/uduse/gists{/gist_id}","starred_url":"https://api.github.com/users/uduse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uduse/subscriptions","organizations_url":"https://api.github.com/users/uduse/orgs","repos_url":"https://api.github.com/users/uduse/repos","events_url":"https://api.github.com/users/uduse/events{/privacy}","received_events_url":"https://api.github.com/users/uduse/received_events","type":"User","site_admin":false},"assignees":[{"login":"uduse","id":4717005,"node_id":"MDQ6VXNlcjQ3MTcwMDU=","avatar_url":"https://avatars2.githubusercontent.com/u/4717005?v=4","gravatar_id":"","url":"https://api.github.com/users/uduse","html_url":"https://github.com/uduse","followers_url":"https://api.github.com/users/uduse/followers","following_url":"https://api.github.com/users/uduse/following{/other_user}","gists_url":"https://api.github.com/users/uduse/gists{/gist_id}","starred_url":"https://api.github.com/users/uduse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uduse/subscriptions","organizations_url":"https://api.github.com/users/uduse/orgs","repos_url":"https://api.github.com/users/uduse/repos","events_url":"https://api.github.com/users/uduse/events{/privacy}","received_events_url":"https://api.github.com/users/uduse/received_events","type":"User","site_admin":false}],"milestone":null,"comments":6,"created_at":"2018-11-05T11:33:09Z","updated_at":"2018-11-13T11:15:14Z","closed_at":"2018-11-13T11:15:14Z","author_association":"NONE","body":"After saving the `preprocessor.DSSMPreprocessor()` and loading it back again, calling:\r\n ```Python\r\npreprocessor.fit_transform(params, stage='predict')\r\n```\r\nwould throw the following error:\r\n```Python\r\nKeyError: 'term_index'\r\n```\r\n\r\nAfter the error, if one calls the fit_transform again, the error would change to:\r\n\r\n```Python\r\nValueError: Please fit parameters before transformation.\r\n```\r\n\r\nHere is how I load and call preprocessor:\r\n```Python\r\nfu_preprocessor.save('trained_models/fu/preprocessor')\r\nfu_model.save('trained_models/fu/model')\r\n...\r\n...\r\n# In a different project\r\nfu_preprocessor = engine.load_preprocessor('trained_models/fu/preprocessor')\r\nfu_model = engine.load_model('trained_models/fu/model')\r\n\r\ndef predict(text1, text2):\r\n    t = [(str(1), str(1), text1, text2)]\r\n    processed = fu_preprocessor.fit_transform(t, stage='predict')\r\n\r\n    x1 = processed.left.values[0][0]\r\n    x2 = processed.right.values[0][0]\r\n\r\n    x1 = x1.reshape(1, -1)\r\n    x2 = x2.reshape(1, -1)\r\n\r\n    pred = fu_model.predict([x1, x2])\r\n    return pred[0][0]\r\n```\r\n\r\nDon't know if this is a issue or I am doing something wrong (**Using MatchZoo:2.0**)."}}
{"actor":{"display_login":"uduse"}}