{"action":"created","comment":{"url":"https://api.github.com/repos/HazyResearch/fonduer/pulls/comments/212139611","pull_request_review_id":148708475,"id":212139611,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMjEzOTYxMQ==","diff_hunk":"@@ -213,29 +158,39 @@ def train(\n             # In categorical setting, just remove unlabeled\n             diffs = Y_train.max(axis=1) - Y_train.min(axis=1)\n             train_idxs = np.where(diffs > 1e-6)[0]\n-        X_train = (\n-            [X_train[j] for j in train_idxs]\n-            if self.representation\n-            else X_train[train_idxs, :]\n+\n+        _X_train, _Y_train = self._preprocess_data(\n+            X_train, Y_train, idxs=train_idxs, train=True\n         )\n-        Y_train = Y_train[train_idxs]\n+        if X_dev is not None:\n+            _X_dev, _Y_dev = self._preprocess_data(X_dev, Y_dev)\n+\n+        self.model_kwargs = self._update_kwargs(_X_train, **kwargs)\n+\n+        if \"host_device\" not in self.model_kwargs:\n+            self.model_kwargs[\"host_device\"] = \"CPU\"\n+            self.logger.info(\"Using CPU...\")\n+        if (\n+            self.model_kwargs[\"host_device\"] in self.gpu\n+            and not torch.cuda.is_available()\n+        ):\n+            self.model_kwargs[\"host_device\"] = \"CPU\"\n+            self.logger.info(\"GPU is not available, switching to CPU...\")","path":"fonduer/learning/disc_learning.py","position":290,"original_position":290,"commit_id":"31ead39762889f18e2f29ea847c0f51f5d5eacc0","original_commit_id":"893d22be31c7742409440c734955635d255ba03b","user":{"login":"SenWu","id":5580008,"node_id":"MDQ6VXNlcjU1ODAwMDg=","avatar_url":"https://avatars0.githubusercontent.com/u/5580008?v=4","gravatar_id":"","url":"https://api.github.com/users/SenWu","html_url":"https://github.com/SenWu","followers_url":"https://api.github.com/users/SenWu/followers","following_url":"https://api.github.com/users/SenWu/following{/other_user}","gists_url":"https://api.github.com/users/SenWu/gists{/gist_id}","starred_url":"https://api.github.com/users/SenWu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SenWu/subscriptions","organizations_url":"https://api.github.com/users/SenWu/orgs","repos_url":"https://api.github.com/users/SenWu/repos","events_url":"https://api.github.com/users/SenWu/events{/privacy}","received_events_url":"https://api.github.com/users/SenWu/received_events","type":"User","site_admin":false},"body":"Add one for GPU as well.","created_at":"2018-08-22T23:16:05Z","updated_at":"2018-08-22T23:16:05Z","html_url":"https://github.com/HazyResearch/fonduer/pull/115#discussion_r212139611","pull_request_url":"https://api.github.com/repos/HazyResearch/fonduer/pulls/115","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/HazyResearch/fonduer/pulls/comments/212139611"},"html":{"href":"https://github.com/HazyResearch/fonduer/pull/115#discussion_r212139611"},"pull_request":{"href":"https://api.github.com/repos/HazyResearch/fonduer/pulls/115"}},"in_reply_to_id":212105828},"pull_request":{"url":"https://api.github.com/repos/HazyResearch/fonduer/pulls/115","id":210075276,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwMDc1Mjc2","html_url":"https://github.com/HazyResearch/fonduer/pull/115","diff_url":"https://github.com/HazyResearch/fonduer/pull/115.diff","patch_url":"https://github.com/HazyResearch/fonduer/pull/115.patch","issue_url":"https://api.github.com/repos/HazyResearch/fonduer/issues/115","number":115,"state":"open","locked":false,"title":"Switch from Tensorflow to Pytorch","user":{"login":"SenWu","id":5580008,"node_id":"MDQ6VXNlcjU1ODAwMDg=","avatar_url":"https://avatars0.githubusercontent.com/u/5580008?v=4","gravatar_id":"","url":"https://api.github.com/users/SenWu","html_url":"https://github.com/SenWu","followers_url":"https://api.github.com/users/SenWu/followers","following_url":"https://api.github.com/users/SenWu/following{/other_user}","gists_url":"https://api.github.com/users/SenWu/gists{/gist_id}","starred_url":"https://api.github.com/users/SenWu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SenWu/subscriptions","organizations_url":"https://api.github.com/users/SenWu/orgs","repos_url":"https://api.github.com/users/SenWu/repos","events_url":"https://api.github.com/users/SenWu/events{/privacy}","received_events_url":"https://api.github.com/users/SenWu/received_events","type":"User","site_admin":false},"body":"In this PR, we switch the learning part to PyTorch and support Logistic Regression and LSTM.\r\n\r\nOne thing to be addressed here is the input of training/prediction function needs to be (candidates, features) instead of features.\r\n","created_at":"2018-08-22T09:41:40Z","updated_at":"2018-08-22T23:16:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"379ec6d59e3867eb9e56b55813d18071d1a70628","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":825323860,"node_id":"MDU6TGFiZWw4MjUzMjM4NjA=","url":"https://api.github.com/repos/HazyResearch/fonduer/labels/enhancement","name":"enhancement","color":"a2eeef","default":true}],"milestone":{"url":"https://api.github.com/repos/HazyResearch/fonduer/milestones/10","html_url":"https://github.com/HazyResearch/fonduer/milestone/10","labels_url":"https://api.github.com/repos/HazyResearch/fonduer/milestones/10/labels","id":3514631,"node_id":"MDk6TWlsZXN0b25lMzUxNDYzMQ==","number":10,"title":"v0.3.0","description":"","creator":{"login":"lukehsiao","id":7573542,"node_id":"MDQ6VXNlcjc1NzM1NDI=","avatar_url":"https://avatars3.githubusercontent.com/u/7573542?v=4","gravatar_id":"","url":"https://api.github.com/users/lukehsiao","html_url":"https://github.com/lukehsiao","followers_url":"https://api.github.com/users/lukehsiao/followers","following_url":"https://api.github.com/users/lukehsiao/following{/other_user}","gists_url":"https://api.github.com/users/lukehsiao/gists{/gist_id}","starred_url":"https://api.github.com/users/lukehsiao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukehsiao/subscriptions","organizations_url":"https://api.github.com/users/lukehsiao/orgs","repos_url":"https://api.github.com/users/lukehsiao/repos","events_url":"https://api.github.com/users/lukehsiao/events{/privacy}","received_events_url":"https://api.github.com/users/lukehsiao/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":22,"state":"open","created_at":"2018-07-23T01:16:09Z","updated_at":"2018-08-22T16:04:49Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/HazyResearch/fonduer/pulls/115/commits","review_comments_url":"https://api.github.com/repos/HazyResearch/fonduer/pulls/115/comments","review_comment_url":"https://api.github.com/repos/HazyResearch/fonduer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HazyResearch/fonduer/issues/115/comments","statuses_url":"https://api.github.com/repos/HazyResearch/fonduer/statuses/31ead39762889f18e2f29ea847c0f51f5d5eacc0","head":{"label":"HazyResearch:pytorch","ref":"pytorch","sha":"31ead39762889f18e2f29ea847c0f51f5d5eacc0","user":{"login":"HazyResearch","id":2165246,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNjUyNDY=","avatar_url":"https://avatars1.githubusercontent.com/u/2165246?v=4","gravatar_id":"","url":"https://api.github.com/users/HazyResearch","html_url":"https://github.com/HazyResearch","followers_url":"https://api.github.com/users/HazyResearch/followers","following_url":"https://api.github.com/users/HazyResearch/following{/other_user}","gists_url":"https://api.github.com/users/HazyResearch/gists{/gist_id}","starred_url":"https://api.github.com/users/HazyResearch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HazyResearch/subscriptions","organizations_url":"https://api.github.com/users/HazyResearch/orgs","repos_url":"https://api.github.com/users/HazyResearch/repos","events_url":"https://api.github.com/users/HazyResearch/events{/privacy}","received_events_url":"https://api.github.com/users/HazyResearch/received_events","type":"Organization","site_admin":false},"repo":{"id":120036188,"node_id":"MDEwOlJlcG9zaXRvcnkxMjAwMzYxODg=","name":"fonduer","full_name":"HazyResearch/fonduer","owner":{"login":"HazyResearch","id":2165246,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNjUyNDY=","avatar_url":"https://avatars1.githubusercontent.com/u/2165246?v=4","gravatar_id":"","url":"https://api.github.com/users/HazyResearch","html_url":"https://github.com/HazyResearch","followers_url":"https://api.github.com/users/HazyResearch/followers","following_url":"https://api.github.com/users/HazyResearch/following{/other_user}","gists_url":"https://api.github.com/users/HazyResearch/gists{/gist_id}","starred_url":"https://api.github.com/users/HazyResearch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HazyResearch/subscriptions","organizations_url":"https://api.github.com/users/HazyResearch/orgs","repos_url":"https://api.github.com/users/HazyResearch/repos","events_url":"https://api.github.com/users/HazyResearch/events{/privacy}","received_events_url":"https://api.github.com/users/HazyResearch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HazyResearch/fonduer","description":":newspaper: a knowledge base construction engine for richly formatted data","fork":false,"url":"https://api.github.com/repos/HazyResearch/fonduer","forks_url":"https://api.github.com/repos/HazyResearch/fonduer/forks","keys_url":"https://api.github.com/repos/HazyResearch/fonduer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HazyResearch/fonduer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HazyResearch/fonduer/teams","hooks_url":"https://api.github.com/repos/HazyResearch/fonduer/hooks","issue_events_url":"https://api.github.com/repos/HazyResearch/fonduer/issues/events{/number}","events_url":"https://api.github.com/repos/HazyResearch/fonduer/events","assignees_url":"https://api.github.com/repos/HazyResearch/fonduer/assignees{/user}","branches_url":"https://api.github.com/repos/HazyResearch/fonduer/branches{/branch}","tags_url":"https://api.github.com/repos/HazyResearch/fonduer/tags","blobs_url":"https://api.github.com/repos/HazyResearch/fonduer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HazyResearch/fonduer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HazyResearch/fonduer/git/refs{/sha}","trees_url":"https://api.github.com/repos/HazyResearch/fonduer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HazyResearch/fonduer/statuses/{sha}","languages_url":"https://api.github.com/repos/HazyResearch/fonduer/languages","stargazers_url":"https://api.github.com/repos/HazyResearch/fonduer/stargazers","contributors_url":"https://api.github.com/repos/HazyResearch/fonduer/contributors","subscribers_url":"https://api.github.com/repos/HazyResearch/fonduer/subscribers","subscription_url":"https://api.github.com/repos/HazyResearch/fonduer/subscription","commits_url":"https://api.github.com/repos/HazyResearch/fonduer/commits{/sha}","git_commits_url":"https://api.github.com/repos/HazyResearch/fonduer/git/commits{/sha}","comments_url":"https://api.github.com/repos/HazyResearch/fonduer/comments{/number}","issue_comment_url":"https://api.github.com/repos/HazyResearch/fonduer/issues/comments{/number}","contents_url":"https://api.github.com/repos/HazyResearch/fonduer/contents/{+path}","compare_url":"https://api.github.com/repos/HazyResearch/fonduer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HazyResearch/fonduer/merges","archive_url":"https://api.github.com/repos/HazyResearch/fonduer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HazyResearch/fonduer/downloads","issues_url":"https://api.github.com/repos/HazyResearch/fonduer/issues{/number}","pulls_url":"https://api.github.com/repos/HazyResearch/fonduer/pulls{/number}","milestones_url":"https://api.github.com/repos/HazyResearch/fonduer/milestones{/number}","notifications_url":"https://api.github.com/repos/HazyResearch/fonduer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HazyResearch/fonduer/labels{/name}","releases_url":"https://api.github.com/repos/HazyResearch/fonduer/releases{/id}","deployments_url":"https://api.github.com/repos/HazyResearch/fonduer/deployments","created_at":"2018-02-02T22:03:13Z","updated_at":"2018-08-22T06:59:57Z","pushed_at":"2018-08-22T21:25:10Z","git_url":"git://github.com/HazyResearch/fonduer.git","ssh_url":"git@github.com:HazyResearch/fonduer.git","clone_url":"https://github.com/HazyResearch/fonduer.git","svn_url":"https://github.com/HazyResearch/fonduer","homepage":"https://fonduer.readthedocs.io/","size":10096,"stargazers_count":53,"watchers_count":53,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":16,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":16,"open_issues":9,"watchers":53,"default_branch":"master"}},"base":{"label":"HazyResearch:master","ref":"master","sha":"6fc8ae039dbb4de5363b6bf8a862a670f9cb6f73","user":{"login":"HazyResearch","id":2165246,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNjUyNDY=","avatar_url":"https://avatars1.githubusercontent.com/u/2165246?v=4","gravatar_id":"","url":"https://api.github.com/users/HazyResearch","html_url":"https://github.com/HazyResearch","followers_url":"https://api.github.com/users/HazyResearch/followers","following_url":"https://api.github.com/users/HazyResearch/following{/other_user}","gists_url":"https://api.github.com/users/HazyResearch/gists{/gist_id}","starred_url":"https://api.github.com/users/HazyResearch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HazyResearch/subscriptions","organizations_url":"https://api.github.com/users/HazyResearch/orgs","repos_url":"https://api.github.com/users/HazyResearch/repos","events_url":"https://api.github.com/users/HazyResearch/events{/privacy}","received_events_url":"https://api.github.com/users/HazyResearch/received_events","type":"Organization","site_admin":false},"repo":{"id":120036188,"node_id":"MDEwOlJlcG9zaXRvcnkxMjAwMzYxODg=","name":"fonduer","full_name":"HazyResearch/fonduer","owner":{"login":"HazyResearch","id":2165246,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNjUyNDY=","avatar_url":"https://avatars1.githubusercontent.com/u/2165246?v=4","gravatar_id":"","url":"https://api.github.com/users/HazyResearch","html_url":"https://github.com/HazyResearch","followers_url":"https://api.github.com/users/HazyResearch/followers","following_url":"https://api.github.com/users/HazyResearch/following{/other_user}","gists_url":"https://api.github.com/users/HazyResearch/gists{/gist_id}","starred_url":"https://api.github.com/users/HazyResearch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HazyResearch/subscriptions","organizations_url":"https://api.github.com/users/HazyResearch/orgs","repos_url":"https://api.github.com/users/HazyResearch/repos","events_url":"https://api.github.com/users/HazyResearch/events{/privacy}","received_events_url":"https://api.github.com/users/HazyResearch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HazyResearch/fonduer","description":":newspaper: a knowledge base construction engine for richly formatted data","fork":false,"url":"https://api.github.com/repos/HazyResearch/fonduer","forks_url":"https://api.github.com/repos/HazyResearch/fonduer/forks","keys_url":"https://api.github.com/repos/HazyResearch/fonduer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HazyResearch/fonduer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HazyResearch/fonduer/teams","hooks_url":"https://api.github.com/repos/HazyResearch/fonduer/hooks","issue_events_url":"https://api.github.com/repos/HazyResearch/fonduer/issues/events{/number}","events_url":"https://api.github.com/repos/HazyResearch/fonduer/events","assignees_url":"https://api.github.com/repos/HazyResearch/fonduer/assignees{/user}","branches_url":"https://api.github.com/repos/HazyResearch/fonduer/branches{/branch}","tags_url":"https://api.github.com/repos/HazyResearch/fonduer/tags","blobs_url":"https://api.github.com/repos/HazyResearch/fonduer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HazyResearch/fonduer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HazyResearch/fonduer/git/refs{/sha}","trees_url":"https://api.github.com/repos/HazyResearch/fonduer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HazyResearch/fonduer/statuses/{sha}","languages_url":"https://api.github.com/repos/HazyResearch/fonduer/languages","stargazers_url":"https://api.github.com/repos/HazyResearch/fonduer/stargazers","contributors_url":"https://api.github.com/repos/HazyResearch/fonduer/contributors","subscribers_url":"https://api.github.com/repos/HazyResearch/fonduer/subscribers","subscription_url":"https://api.github.com/repos/HazyResearch/fonduer/subscription","commits_url":"https://api.github.com/repos/HazyResearch/fonduer/commits{/sha}","git_commits_url":"https://api.github.com/repos/HazyResearch/fonduer/git/commits{/sha}","comments_url":"https://api.github.com/repos/HazyResearch/fonduer/comments{/number}","issue_comment_url":"https://api.github.com/repos/HazyResearch/fonduer/issues/comments{/number}","contents_url":"https://api.github.com/repos/HazyResearch/fonduer/contents/{+path}","compare_url":"https://api.github.com/repos/HazyResearch/fonduer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HazyResearch/fonduer/merges","archive_url":"https://api.github.com/repos/HazyResearch/fonduer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HazyResearch/fonduer/downloads","issues_url":"https://api.github.com/repos/HazyResearch/fonduer/issues{/number}","pulls_url":"https://api.github.com/repos/HazyResearch/fonduer/pulls{/number}","milestones_url":"https://api.github.com/repos/HazyResearch/fonduer/milestones{/number}","notifications_url":"https://api.github.com/repos/HazyResearch/fonduer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HazyResearch/fonduer/labels{/name}","releases_url":"https://api.github.com/repos/HazyResearch/fonduer/releases{/id}","deployments_url":"https://api.github.com/repos/HazyResearch/fonduer/deployments","created_at":"2018-02-02T22:03:13Z","updated_at":"2018-08-22T06:59:57Z","pushed_at":"2018-08-22T21:25:10Z","git_url":"git://github.com/HazyResearch/fonduer.git","ssh_url":"git@github.com:HazyResearch/fonduer.git","clone_url":"https://github.com/HazyResearch/fonduer.git","svn_url":"https://github.com/HazyResearch/fonduer","homepage":"https://fonduer.readthedocs.io/","size":10096,"stargazers_count":53,"watchers_count":53,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":16,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":16,"open_issues":9,"watchers":53,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/HazyResearch/fonduer/pulls/115"},"html":{"href":"https://github.com/HazyResearch/fonduer/pull/115"},"issue":{"href":"https://api.github.com/repos/HazyResearch/fonduer/issues/115"},"comments":{"href":"https://api.github.com/repos/HazyResearch/fonduer/issues/115/comments"},"review_comments":{"href":"https://api.github.com/repos/HazyResearch/fonduer/pulls/115/comments"},"review_comment":{"href":"https://api.github.com/repos/HazyResearch/fonduer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HazyResearch/fonduer/pulls/115/commits"},"statuses":{"href":"https://api.github.com/repos/HazyResearch/fonduer/statuses/31ead39762889f18e2f29ea847c0f51f5d5eacc0"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"SenWu"}}