{"action":"created","comment":{"url":"https://api.github.com/repos/IndicoDataSolutions/finetune/pulls/comments/202090235","pull_request_review_id":136719511,"id":202090235,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMjA5MDIzNQ==","diff_hunk":"@@ -119,32 +125,49 @@ def bpe(self, token):\n         self.cache[token] = word\n         return word\n \n-    def encode(self, texts, verbose=True):\n+    def _encode(self, texts, verbose=True):\n         \"\"\"\n         Convert a batch of raw text to a batch of byte-pair encoded token indices.\n         \"\"\"\n         batch_token_idxs = []\n-\n+        batch_label_idxs = []\n+        batch_character_locs = []\n+        label = None\n         if verbose:\n             texts = tqdm(texts, ncols=80, leave=False)\n \n         for text in texts:\n+            if type(text) != str and len(text) == 2:\n+                text, label = text\n+\n+            raw_text = text.lower()\n             text = self.nlp(text_standardize(text))\n             token_idxs = []\n+            tok_pos = []\n             for token in text:\n+                bpe_toks = self.bpe(token.text).split()\n                 token_idxs.extend([\n                     self.encoder.get(t, self.UNK_IDX)\n-                    for t in self.bpe(token.text).split()\n+                    for t in bpe_toks\n                 ])\n+                token_idx = raw_text.find(token.text, tok_pos[-1] if tok_pos else 0)\n+                assert len(\"\".join(bpe_toks).replace(\"</w>\", \"\")) == len(token), \"{}, {}\".format(bpe_toks, token)","path":"finetune/encoding.py","position":60,"original_position":60,"commit_id":"55bae99a6ef4ce19774b48b3da30c2eda560a9b0","original_commit_id":"55bae99a6ef4ce19774b48b3da30c2eda560a9b0","user":{"login":"madisonmay","id":2645393,"node_id":"MDQ6VXNlcjI2NDUzOTM=","avatar_url":"https://avatars0.githubusercontent.com/u/2645393?v=4","gravatar_id":"","url":"https://api.github.com/users/madisonmay","html_url":"https://github.com/madisonmay","followers_url":"https://api.github.com/users/madisonmay/followers","following_url":"https://api.github.com/users/madisonmay/following{/other_user}","gists_url":"https://api.github.com/users/madisonmay/gists{/gist_id}","starred_url":"https://api.github.com/users/madisonmay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madisonmay/subscriptions","organizations_url":"https://api.github.com/users/madisonmay/orgs","repos_url":"https://api.github.com/users/madisonmay/repos","events_url":"https://api.github.com/users/madisonmay/events{/privacy}","received_events_url":"https://api.github.com/users/madisonmay/received_events","type":"User","site_admin":false},"body":"Have some questions here for in person","created_at":"2018-07-12T16:00:28Z","updated_at":"2018-07-12T16:00:29Z","html_url":"https://github.com/IndicoDataSolutions/finetune/pull/34#discussion_r202090235","pull_request_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/pulls/34","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/IndicoDataSolutions/finetune/pulls/comments/202090235"},"html":{"href":"https://github.com/IndicoDataSolutions/finetune/pull/34#discussion_r202090235"},"pull_request":{"href":"https://api.github.com/repos/IndicoDataSolutions/finetune/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/IndicoDataSolutions/finetune/pulls/34","id":200719459,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAwNzE5NDU5","html_url":"https://github.com/IndicoDataSolutions/finetune/pull/34","diff_url":"https://github.com/IndicoDataSolutions/finetune/pull/34.diff","patch_url":"https://github.com/IndicoDataSolutions/finetune/pull/34.patch","issue_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/issues/34","number":34,"state":"open","locked":false,"title":"Ben/add seq labeling","user":{"login":"madisonmay","id":2645393,"node_id":"MDQ6VXNlcjI2NDUzOTM=","avatar_url":"https://avatars0.githubusercontent.com/u/2645393?v=4","gravatar_id":"","url":"https://api.github.com/users/madisonmay","html_url":"https://github.com/madisonmay","followers_url":"https://api.github.com/users/madisonmay/followers","following_url":"https://api.github.com/users/madisonmay/following{/other_user}","gists_url":"https://api.github.com/users/madisonmay/gists{/gist_id}","starred_url":"https://api.github.com/users/madisonmay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madisonmay/subscriptions","organizations_url":"https://api.github.com/users/madisonmay/orgs","repos_url":"https://api.github.com/users/madisonmay/repos","events_url":"https://api.github.com/users/madisonmay/events{/privacy}","received_events_url":"https://api.github.com/users/madisonmay/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-11T14:27:22Z","updated_at":"2018-07-12T16:00:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c1f66d1edc424c66844832bf185bc90a0666d3c0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/pulls/34/commits","review_comments_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/pulls/34/comments","review_comment_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/pulls/comments{/number}","comments_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/issues/34/comments","statuses_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/statuses/55bae99a6ef4ce19774b48b3da30c2eda560a9b0","head":{"label":"IndicoDataSolutions:ben/add_seq_labeling","ref":"ben/add_seq_labeling","sha":"55bae99a6ef4ce19774b48b3da30c2eda560a9b0","user":{"login":"IndicoDataSolutions","id":6751793,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3NTE3OTM=","avatar_url":"https://avatars2.githubusercontent.com/u/6751793?v=4","gravatar_id":"","url":"https://api.github.com/users/IndicoDataSolutions","html_url":"https://github.com/IndicoDataSolutions","followers_url":"https://api.github.com/users/IndicoDataSolutions/followers","following_url":"https://api.github.com/users/IndicoDataSolutions/following{/other_user}","gists_url":"https://api.github.com/users/IndicoDataSolutions/gists{/gist_id}","starred_url":"https://api.github.com/users/IndicoDataSolutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IndicoDataSolutions/subscriptions","organizations_url":"https://api.github.com/users/IndicoDataSolutions/orgs","repos_url":"https://api.github.com/users/IndicoDataSolutions/repos","events_url":"https://api.github.com/users/IndicoDataSolutions/events{/privacy}","received_events_url":"https://api.github.com/users/IndicoDataSolutions/received_events","type":"Organization","site_admin":false},"repo":{"id":137103159,"node_id":"MDEwOlJlcG9zaXRvcnkxMzcxMDMxNTk=","name":"finetune","full_name":"IndicoDataSolutions/finetune","owner":{"login":"IndicoDataSolutions","id":6751793,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3NTE3OTM=","avatar_url":"https://avatars2.githubusercontent.com/u/6751793?v=4","gravatar_id":"","url":"https://api.github.com/users/IndicoDataSolutions","html_url":"https://github.com/IndicoDataSolutions","followers_url":"https://api.github.com/users/IndicoDataSolutions/followers","following_url":"https://api.github.com/users/IndicoDataSolutions/following{/other_user}","gists_url":"https://api.github.com/users/IndicoDataSolutions/gists{/gist_id}","starred_url":"https://api.github.com/users/IndicoDataSolutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IndicoDataSolutions/subscriptions","organizations_url":"https://api.github.com/users/IndicoDataSolutions/orgs","repos_url":"https://api.github.com/users/IndicoDataSolutions/repos","events_url":"https://api.github.com/users/IndicoDataSolutions/events{/privacy}","received_events_url":"https://api.github.com/users/IndicoDataSolutions/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/IndicoDataSolutions/finetune","description":"Code and model for the paper \"Improving Language Understanding by Generative Pre-Training\"","fork":false,"url":"https://api.github.com/repos/IndicoDataSolutions/finetune","forks_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/forks","keys_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/teams","hooks_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/hooks","issue_events_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/issues/events{/number}","events_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/events","assignees_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/assignees{/user}","branches_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/branches{/branch}","tags_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/tags","blobs_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/git/refs{/sha}","trees_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/statuses/{sha}","languages_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/languages","stargazers_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/stargazers","contributors_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/contributors","subscribers_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/subscribers","subscription_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/subscription","commits_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/commits{/sha}","git_commits_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/git/commits{/sha}","comments_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/comments{/number}","issue_comment_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/issues/comments{/number}","contents_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/contents/{+path}","compare_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/merges","archive_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/downloads","issues_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/issues{/number}","pulls_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/pulls{/number}","milestones_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/milestones{/number}","notifications_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/labels{/name}","releases_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/releases{/id}","deployments_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/deployments","created_at":"2018-06-12T17:02:16Z","updated_at":"2018-07-12T14:08:09Z","pushed_at":"2018-07-12T15:23:43Z","git_url":"git://github.com/IndicoDataSolutions/finetune.git","ssh_url":"git@github.com:IndicoDataSolutions/finetune.git","clone_url":"https://github.com/IndicoDataSolutions/finetune.git","svn_url":"https://github.com/IndicoDataSolutions/finetune","homepage":"https://finetune.indico.io","size":425018,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":2,"watchers":5,"default_branch":"master"}},"base":{"label":"IndicoDataSolutions:master","ref":"master","sha":"0594fd14023b4706e1f9d1f70f3be51961880ee8","user":{"login":"IndicoDataSolutions","id":6751793,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3NTE3OTM=","avatar_url":"https://avatars2.githubusercontent.com/u/6751793?v=4","gravatar_id":"","url":"https://api.github.com/users/IndicoDataSolutions","html_url":"https://github.com/IndicoDataSolutions","followers_url":"https://api.github.com/users/IndicoDataSolutions/followers","following_url":"https://api.github.com/users/IndicoDataSolutions/following{/other_user}","gists_url":"https://api.github.com/users/IndicoDataSolutions/gists{/gist_id}","starred_url":"https://api.github.com/users/IndicoDataSolutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IndicoDataSolutions/subscriptions","organizations_url":"https://api.github.com/users/IndicoDataSolutions/orgs","repos_url":"https://api.github.com/users/IndicoDataSolutions/repos","events_url":"https://api.github.com/users/IndicoDataSolutions/events{/privacy}","received_events_url":"https://api.github.com/users/IndicoDataSolutions/received_events","type":"Organization","site_admin":false},"repo":{"id":137103159,"node_id":"MDEwOlJlcG9zaXRvcnkxMzcxMDMxNTk=","name":"finetune","full_name":"IndicoDataSolutions/finetune","owner":{"login":"IndicoDataSolutions","id":6751793,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3NTE3OTM=","avatar_url":"https://avatars2.githubusercontent.com/u/6751793?v=4","gravatar_id":"","url":"https://api.github.com/users/IndicoDataSolutions","html_url":"https://github.com/IndicoDataSolutions","followers_url":"https://api.github.com/users/IndicoDataSolutions/followers","following_url":"https://api.github.com/users/IndicoDataSolutions/following{/other_user}","gists_url":"https://api.github.com/users/IndicoDataSolutions/gists{/gist_id}","starred_url":"https://api.github.com/users/IndicoDataSolutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IndicoDataSolutions/subscriptions","organizations_url":"https://api.github.com/users/IndicoDataSolutions/orgs","repos_url":"https://api.github.com/users/IndicoDataSolutions/repos","events_url":"https://api.github.com/users/IndicoDataSolutions/events{/privacy}","received_events_url":"https://api.github.com/users/IndicoDataSolutions/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/IndicoDataSolutions/finetune","description":"Code and model for the paper \"Improving Language Understanding by Generative Pre-Training\"","fork":false,"url":"https://api.github.com/repos/IndicoDataSolutions/finetune","forks_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/forks","keys_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/teams","hooks_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/hooks","issue_events_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/issues/events{/number}","events_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/events","assignees_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/assignees{/user}","branches_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/branches{/branch}","tags_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/tags","blobs_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/git/refs{/sha}","trees_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/statuses/{sha}","languages_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/languages","stargazers_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/stargazers","contributors_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/contributors","subscribers_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/subscribers","subscription_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/subscription","commits_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/commits{/sha}","git_commits_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/git/commits{/sha}","comments_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/comments{/number}","issue_comment_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/issues/comments{/number}","contents_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/contents/{+path}","compare_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/merges","archive_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/downloads","issues_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/issues{/number}","pulls_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/pulls{/number}","milestones_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/milestones{/number}","notifications_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/labels{/name}","releases_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/releases{/id}","deployments_url":"https://api.github.com/repos/IndicoDataSolutions/finetune/deployments","created_at":"2018-06-12T17:02:16Z","updated_at":"2018-07-12T14:08:09Z","pushed_at":"2018-07-12T15:23:43Z","git_url":"git://github.com/IndicoDataSolutions/finetune.git","ssh_url":"git@github.com:IndicoDataSolutions/finetune.git","clone_url":"https://github.com/IndicoDataSolutions/finetune.git","svn_url":"https://github.com/IndicoDataSolutions/finetune","homepage":"https://finetune.indico.io","size":425018,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":2,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/IndicoDataSolutions/finetune/pulls/34"},"html":{"href":"https://github.com/IndicoDataSolutions/finetune/pull/34"},"issue":{"href":"https://api.github.com/repos/IndicoDataSolutions/finetune/issues/34"},"comments":{"href":"https://api.github.com/repos/IndicoDataSolutions/finetune/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/IndicoDataSolutions/finetune/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/IndicoDataSolutions/finetune/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/IndicoDataSolutions/finetune/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/IndicoDataSolutions/finetune/statuses/55bae99a6ef4ce19774b48b3da30c2eda560a9b0"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"madisonmay"}}