{"action":"created","comment":{"url":"https://api.github.com/repos/allenai/allennlp/pulls/comments/187191815","pull_request_review_id":118911521,"id":187191815,"diff_hunk":"@@ -568,8 +550,7 @@ def test_flattened_index_select(self):\n         targets = torch.ones([2, 6, 3]).cumsum(1) - 1\n         # Make the second batch double it's index so they're different.\n         targets[1, :, :] *= 2\n-        indices = Variable(torch.LongTensor(indices))\n-        targets = Variable(targets)\n+        indices = torch.from_numpy(indices).long()","path":"tests/nn/util_test.py","position":403,"original_position":413,"commit_id":"0b50643274b5b0d57c72a31475683dec257ec23f","original_commit_id":"0b50643274b5b0d57c72a31475683dec257ec23f","user":{"login":"matt-gardner","id":3291951,"avatar_url":"https://avatars2.githubusercontent.com/u/3291951?v=4","gravatar_id":"","url":"https://api.github.com/users/matt-gardner","html_url":"https://github.com/matt-gardner","followers_url":"https://api.github.com/users/matt-gardner/followers","following_url":"https://api.github.com/users/matt-gardner/following{/other_user}","gists_url":"https://api.github.com/users/matt-gardner/gists{/gist_id}","starred_url":"https://api.github.com/users/matt-gardner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matt-gardner/subscriptions","organizations_url":"https://api.github.com/users/matt-gardner/orgs","repos_url":"https://api.github.com/users/matt-gardner/repos","events_url":"https://api.github.com/users/matt-gardner/events{/privacy}","received_events_url":"https://api.github.com/users/matt-gardner/received_events","type":"User","site_admin":false},"body":"`dtype=torch.long`","created_at":"2018-05-09T22:15:18Z","updated_at":"2018-05-09T22:16:27Z","html_url":"https://github.com/allenai/allennlp/pull/1126#discussion_r187191815","pull_request_url":"https://api.github.com/repos/allenai/allennlp/pulls/1126","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/allenai/allennlp/pulls/comments/187191815"},"html":{"href":"https://github.com/allenai/allennlp/pull/1126#discussion_r187191815"},"pull_request":{"href":"https://api.github.com/repos/allenai/allennlp/pulls/1126"}}},"pull_request":{"url":"https://api.github.com/repos/allenai/allennlp/pulls/1126","id":183889879,"html_url":"https://github.com/allenai/allennlp/pull/1126","diff_url":"https://github.com/allenai/allennlp/pull/1126.diff","patch_url":"https://github.com/allenai/allennlp/pull/1126.patch","issue_url":"https://api.github.com/repos/allenai/allennlp/issues/1126","number":1126,"state":"open","locked":false,"title":"upgrade to pytorch 0.4.0","user":{"login":"joelgrus","id":1308313,"avatar_url":"https://avatars1.githubusercontent.com/u/1308313?v=4","gravatar_id":"","url":"https://api.github.com/users/joelgrus","html_url":"https://github.com/joelgrus","followers_url":"https://api.github.com/users/joelgrus/followers","following_url":"https://api.github.com/users/joelgrus/following{/other_user}","gists_url":"https://api.github.com/users/joelgrus/gists{/gist_id}","starred_url":"https://api.github.com/users/joelgrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joelgrus/subscriptions","organizations_url":"https://api.github.com/users/joelgrus/orgs","repos_url":"https://api.github.com/users/joelgrus/repos","events_url":"https://api.github.com/users/joelgrus/events{/privacy}","received_events_url":"https://api.github.com/users/joelgrus/received_events","type":"User","site_admin":false},"body":"I think you will be pleased with the results; on the whole the codebase feels quite a bit cleaner.\r\n\r\nFor the most part I tried to follow the migration guide:\r\n\r\nhttp://pytorch.org/2018/04/22/0_4_0-migration-guide.html\r\n\r\nat a high level that included the following\r\n\r\n* get rid of every reference to `torch.autograd.Variable`\r\n* replace the typechecks for tensors with their recommended (unidiomatic way), and factor out into a `is_tensor` function\r\n* dealing with the new 0-tensors everywhere (.item() instead of [0])\r\n* replacing the `volatile` flags on tensors with `with torch.no_grad()` context blocks (I *think* I put them in the right places)\r\n* all the `initializer` functions are now `initializer_`\r\n* I had to upgrade tensorboardX to 1.2 (the version we were on didn't work with pytorch 0.4)\r\n* replacing the clunky `new()` logic for making new tensors on specific devices with the new pytorch 0.4 ways of doing things `old_tensor.new_zeros(10)`, `old_tensor.new_tensor([x, y, z])` and so on\r\n\r\nwhat I did not do:\r\n\r\n* any of the \"writing device agnostic code\" stuff in that guide. that's likely a good idea, but it deserves its own PR.\r\n\r\n--\r\n\r\nWhen I started there were 100s of warnings; there are still two left that I'm not 100% sure how to fix:\r\n\r\n```\r\ntests/models/sniff_test.py::SniffTest::test_coreference_resolution\r\n  /home/joelg/miniconda3/envs/pytorch40/lib/python3.6/site-packages/torch/nn/modules/rnn.py:38: UserWarning: dropout option adds dropout after all but last recurrent layer, so non-zero dropout expects num_layers greater than 1, but got dropout=0.2 and num_layers=1\r\n    \"num_layers={}\".format(dropout, num_layers))\r\n\r\ntests/models/sniff_test.py::SniffTest::test_machine_comprehension\r\n  /home/joelg/miniconda3/envs/pytorch40/lib/python3.6/site-packages/torch/nn/modules/rnn.py:38: UserWarning: dropout option adds dropout after all but last recurrent layer, so non-zero dropout expects num_layers greater than 1, but got dropout=0.2 and num_layers=1\r\n    \"num_layers={}\".format(dropout, num_layers))\r\n```\r\n\r\nboth only occur in the `SniffTest`, so maybe they are not worth worrying about. or maybe we need to update the models that those two rely on? in any case, I'm not losing too much sleep over them.","created_at":"2018-04-24T23:21:22Z","updated_at":"2018-05-09T22:16:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0dae6316820d1647c1e285b80b5fb513f2420e7c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":{"url":"https://api.github.com/repos/allenai/allennlp/milestones/5","html_url":"https://github.com/allenai/allennlp/milestone/5","labels_url":"https://api.github.com/repos/allenai/allennlp/milestones/5/labels","id":3305198,"number":5,"title":"AllenNLP Release 4.3 (Pytorch 0.4)","description":"","creator":{"login":"schmmd","id":954798,"avatar_url":"https://avatars3.githubusercontent.com/u/954798?v=4","gravatar_id":"","url":"https://api.github.com/users/schmmd","html_url":"https://github.com/schmmd","followers_url":"https://api.github.com/users/schmmd/followers","following_url":"https://api.github.com/users/schmmd/following{/other_user}","gists_url":"https://api.github.com/users/schmmd/gists{/gist_id}","starred_url":"https://api.github.com/users/schmmd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schmmd/subscriptions","organizations_url":"https://api.github.com/users/schmmd/orgs","repos_url":"https://api.github.com/users/schmmd/repos","events_url":"https://api.github.com/users/schmmd/events{/privacy}","received_events_url":"https://api.github.com/users/schmmd/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":0,"state":"open","created_at":"2018-04-27T20:34:21Z","updated_at":"2018-05-01T16:55:36Z","due_on":"2018-05-15T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/allenai/allennlp/pulls/1126/commits","review_comments_url":"https://api.github.com/repos/allenai/allennlp/pulls/1126/comments","review_comment_url":"https://api.github.com/repos/allenai/allennlp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/allenai/allennlp/issues/1126/comments","statuses_url":"https://api.github.com/repos/allenai/allennlp/statuses/0b50643274b5b0d57c72a31475683dec257ec23f","head":{"label":"allenai:pytorch-0.4","ref":"pytorch-0.4","sha":"0b50643274b5b0d57c72a31475683dec257ec23f","user":{"login":"allenai","id":5667695,"avatar_url":"https://avatars3.githubusercontent.com/u/5667695?v=4","gravatar_id":"","url":"https://api.github.com/users/allenai","html_url":"https://github.com/allenai","followers_url":"https://api.github.com/users/allenai/followers","following_url":"https://api.github.com/users/allenai/following{/other_user}","gists_url":"https://api.github.com/users/allenai/gists{/gist_id}","starred_url":"https://api.github.com/users/allenai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allenai/subscriptions","organizations_url":"https://api.github.com/users/allenai/orgs","repos_url":"https://api.github.com/users/allenai/repos","events_url":"https://api.github.com/users/allenai/events{/privacy}","received_events_url":"https://api.github.com/users/allenai/received_events","type":"Organization","site_admin":false},"repo":{"id":91356408,"name":"allennlp","full_name":"allenai/allennlp","owner":{"login":"allenai","id":5667695,"avatar_url":"https://avatars3.githubusercontent.com/u/5667695?v=4","gravatar_id":"","url":"https://api.github.com/users/allenai","html_url":"https://github.com/allenai","followers_url":"https://api.github.com/users/allenai/followers","following_url":"https://api.github.com/users/allenai/following{/other_user}","gists_url":"https://api.github.com/users/allenai/gists{/gist_id}","starred_url":"https://api.github.com/users/allenai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allenai/subscriptions","organizations_url":"https://api.github.com/users/allenai/orgs","repos_url":"https://api.github.com/users/allenai/repos","events_url":"https://api.github.com/users/allenai/events{/privacy}","received_events_url":"https://api.github.com/users/allenai/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/allenai/allennlp","description":"An open-source NLP research library, built on PyTorch.","fork":false,"url":"https://api.github.com/repos/allenai/allennlp","forks_url":"https://api.github.com/repos/allenai/allennlp/forks","keys_url":"https://api.github.com/repos/allenai/allennlp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/allenai/allennlp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/allenai/allennlp/teams","hooks_url":"https://api.github.com/repos/allenai/allennlp/hooks","issue_events_url":"https://api.github.com/repos/allenai/allennlp/issues/events{/number}","events_url":"https://api.github.com/repos/allenai/allennlp/events","assignees_url":"https://api.github.com/repos/allenai/allennlp/assignees{/user}","branches_url":"https://api.github.com/repos/allenai/allennlp/branches{/branch}","tags_url":"https://api.github.com/repos/allenai/allennlp/tags","blobs_url":"https://api.github.com/repos/allenai/allennlp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/allenai/allennlp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/allenai/allennlp/git/refs{/sha}","trees_url":"https://api.github.com/repos/allenai/allennlp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/allenai/allennlp/statuses/{sha}","languages_url":"https://api.github.com/repos/allenai/allennlp/languages","stargazers_url":"https://api.github.com/repos/allenai/allennlp/stargazers","contributors_url":"https://api.github.com/repos/allenai/allennlp/contributors","subscribers_url":"https://api.github.com/repos/allenai/allennlp/subscribers","subscription_url":"https://api.github.com/repos/allenai/allennlp/subscription","commits_url":"https://api.github.com/repos/allenai/allennlp/commits{/sha}","git_commits_url":"https://api.github.com/repos/allenai/allennlp/git/commits{/sha}","comments_url":"https://api.github.com/repos/allenai/allennlp/comments{/number}","issue_comment_url":"https://api.github.com/repos/allenai/allennlp/issues/comments{/number}","contents_url":"https://api.github.com/repos/allenai/allennlp/contents/{+path}","compare_url":"https://api.github.com/repos/allenai/allennlp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/allenai/allennlp/merges","archive_url":"https://api.github.com/repos/allenai/allennlp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/allenai/allennlp/downloads","issues_url":"https://api.github.com/repos/allenai/allennlp/issues{/number}","pulls_url":"https://api.github.com/repos/allenai/allennlp/pulls{/number}","milestones_url":"https://api.github.com/repos/allenai/allennlp/milestones{/number}","notifications_url":"https://api.github.com/repos/allenai/allennlp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/allenai/allennlp/labels{/name}","releases_url":"https://api.github.com/repos/allenai/allennlp/releases{/id}","deployments_url":"https://api.github.com/repos/allenai/allennlp/deployments","created_at":"2017-05-15T15:52:41Z","updated_at":"2018-05-09T15:23:00Z","pushed_at":"2018-05-09T04:58:15Z","git_url":"git://github.com/allenai/allennlp.git","ssh_url":"git@github.com:allenai/allennlp.git","clone_url":"https://github.com/allenai/allennlp.git","svn_url":"https://github.com/allenai/allennlp","homepage":"http://www.allennlp.org/","size":10856,"stargazers_count":2032,"watchers_count":2032,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":298,"mirror_url":null,"archived":false,"open_issues_count":73,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":298,"open_issues":73,"watchers":2032,"default_branch":"master"}},"base":{"label":"allenai:master","ref":"master","sha":"58f90337c2e5dd2344a438875fe719bf328ac912","user":{"login":"allenai","id":5667695,"avatar_url":"https://avatars3.githubusercontent.com/u/5667695?v=4","gravatar_id":"","url":"https://api.github.com/users/allenai","html_url":"https://github.com/allenai","followers_url":"https://api.github.com/users/allenai/followers","following_url":"https://api.github.com/users/allenai/following{/other_user}","gists_url":"https://api.github.com/users/allenai/gists{/gist_id}","starred_url":"https://api.github.com/users/allenai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allenai/subscriptions","organizations_url":"https://api.github.com/users/allenai/orgs","repos_url":"https://api.github.com/users/allenai/repos","events_url":"https://api.github.com/users/allenai/events{/privacy}","received_events_url":"https://api.github.com/users/allenai/received_events","type":"Organization","site_admin":false},"repo":{"id":91356408,"name":"allennlp","full_name":"allenai/allennlp","owner":{"login":"allenai","id":5667695,"avatar_url":"https://avatars3.githubusercontent.com/u/5667695?v=4","gravatar_id":"","url":"https://api.github.com/users/allenai","html_url":"https://github.com/allenai","followers_url":"https://api.github.com/users/allenai/followers","following_url":"https://api.github.com/users/allenai/following{/other_user}","gists_url":"https://api.github.com/users/allenai/gists{/gist_id}","starred_url":"https://api.github.com/users/allenai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allenai/subscriptions","organizations_url":"https://api.github.com/users/allenai/orgs","repos_url":"https://api.github.com/users/allenai/repos","events_url":"https://api.github.com/users/allenai/events{/privacy}","received_events_url":"https://api.github.com/users/allenai/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/allenai/allennlp","description":"An open-source NLP research library, built on PyTorch.","fork":false,"url":"https://api.github.com/repos/allenai/allennlp","forks_url":"https://api.github.com/repos/allenai/allennlp/forks","keys_url":"https://api.github.com/repos/allenai/allennlp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/allenai/allennlp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/allenai/allennlp/teams","hooks_url":"https://api.github.com/repos/allenai/allennlp/hooks","issue_events_url":"https://api.github.com/repos/allenai/allennlp/issues/events{/number}","events_url":"https://api.github.com/repos/allenai/allennlp/events","assignees_url":"https://api.github.com/repos/allenai/allennlp/assignees{/user}","branches_url":"https://api.github.com/repos/allenai/allennlp/branches{/branch}","tags_url":"https://api.github.com/repos/allenai/allennlp/tags","blobs_url":"https://api.github.com/repos/allenai/allennlp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/allenai/allennlp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/allenai/allennlp/git/refs{/sha}","trees_url":"https://api.github.com/repos/allenai/allennlp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/allenai/allennlp/statuses/{sha}","languages_url":"https://api.github.com/repos/allenai/allennlp/languages","stargazers_url":"https://api.github.com/repos/allenai/allennlp/stargazers","contributors_url":"https://api.github.com/repos/allenai/allennlp/contributors","subscribers_url":"https://api.github.com/repos/allenai/allennlp/subscribers","subscription_url":"https://api.github.com/repos/allenai/allennlp/subscription","commits_url":"https://api.github.com/repos/allenai/allennlp/commits{/sha}","git_commits_url":"https://api.github.com/repos/allenai/allennlp/git/commits{/sha}","comments_url":"https://api.github.com/repos/allenai/allennlp/comments{/number}","issue_comment_url":"https://api.github.com/repos/allenai/allennlp/issues/comments{/number}","contents_url":"https://api.github.com/repos/allenai/allennlp/contents/{+path}","compare_url":"https://api.github.com/repos/allenai/allennlp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/allenai/allennlp/merges","archive_url":"https://api.github.com/repos/allenai/allennlp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/allenai/allennlp/downloads","issues_url":"https://api.github.com/repos/allenai/allennlp/issues{/number}","pulls_url":"https://api.github.com/repos/allenai/allennlp/pulls{/number}","milestones_url":"https://api.github.com/repos/allenai/allennlp/milestones{/number}","notifications_url":"https://api.github.com/repos/allenai/allennlp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/allenai/allennlp/labels{/name}","releases_url":"https://api.github.com/repos/allenai/allennlp/releases{/id}","deployments_url":"https://api.github.com/repos/allenai/allennlp/deployments","created_at":"2017-05-15T15:52:41Z","updated_at":"2018-05-09T15:23:00Z","pushed_at":"2018-05-09T04:58:15Z","git_url":"git://github.com/allenai/allennlp.git","ssh_url":"git@github.com:allenai/allennlp.git","clone_url":"https://github.com/allenai/allennlp.git","svn_url":"https://github.com/allenai/allennlp","homepage":"http://www.allennlp.org/","size":10856,"stargazers_count":2032,"watchers_count":2032,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":298,"mirror_url":null,"archived":false,"open_issues_count":73,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":298,"open_issues":73,"watchers":2032,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/allenai/allennlp/pulls/1126"},"html":{"href":"https://github.com/allenai/allennlp/pull/1126"},"issue":{"href":"https://api.github.com/repos/allenai/allennlp/issues/1126"},"comments":{"href":"https://api.github.com/repos/allenai/allennlp/issues/1126/comments"},"review_comments":{"href":"https://api.github.com/repos/allenai/allennlp/pulls/1126/comments"},"review_comment":{"href":"https://api.github.com/repos/allenai/allennlp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/allenai/allennlp/pulls/1126/commits"},"statuses":{"href":"https://api.github.com/repos/allenai/allennlp/statuses/0b50643274b5b0d57c72a31475683dec257ec23f"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"matt-gardner"}}