{"action":"created","issue":{"url":"https://api.github.com/repos/chenyuntc/pytorch-book/issues/74","repository_url":"https://api.github.com/repos/chenyuntc/pytorch-book","labels_url":"https://api.github.com/repos/chenyuntc/pytorch-book/issues/74/labels{/name}","comments_url":"https://api.github.com/repos/chenyuntc/pytorch-book/issues/74/comments","events_url":"https://api.github.com/repos/chenyuntc/pytorch-book/issues/74/events","html_url":"https://github.com/chenyuntc/pytorch-book/issues/74","id":340119675,"node_id":"MDU6SXNzdWUzNDAxMTk2NzU=","number":74,"title":"chapter10-图像描述(Image Caption)  运行demo.ipynb出错","user":{"login":"zhangqianjin","id":12060116,"node_id":"MDQ6VXNlcjEyMDYwMTE2","avatar_url":"https://avatars1.githubusercontent.com/u/12060116?v=4","gravatar_id":"","url":"https://api.github.com/users/zhangqianjin","html_url":"https://github.com/zhangqianjin","followers_url":"https://api.github.com/users/zhangqianjin/followers","following_url":"https://api.github.com/users/zhangqianjin/following{/other_user}","gists_url":"https://api.github.com/users/zhangqianjin/gists{/gist_id}","starred_url":"https://api.github.com/users/zhangqianjin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhangqianjin/subscriptions","organizations_url":"https://api.github.com/users/zhangqianjin/orgs","repos_url":"https://api.github.com/users/zhangqianjin/repos","events_url":"https://api.github.com/users/zhangqianjin/events{/privacy}","received_events_url":"https://api.github.com/users/zhangqianjin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-11T07:15:49Z","updated_at":"2019-01-03T07:43:29Z","closed_at":"2018-07-23T14:09:33Z","author_association":"NONE","body":"python3.5 + pytorch 0.4\r\n\r\nresults = model.generate(img_feats.data[0])\r\nprint('\\r\\n'.join(results))\r\n\r\n\r\nKeyError                                  Traceback (most recent call last)\r\n<ipython-input-26-7eb52668358c> in <module>()\r\n      5 #      model.cuda()\r\n      6 \r\n----> 7 results = model.generate(img_feats.data[0])\r\n      8 # print('\\r\\n'.join(results))\r\n\r\n*/PyTorch-book/chapter10-图像描述(Image Caption)/model.py in generate(self, img, eos_token, beam_size, max_caption_length, length_normalization_factor)\r\n     58         sentences, score = cap_gen.beam_search(img)\r\n     59         sentences = [' '.join([self.ix2word[idx] for idx in sent])\r\n---> 60                      for sent in sentences]\r\n     61         return sentences\r\n     62 \r\n\r\n*/PyTorch-book/chapter10-图像描述(Image Caption)/model.py in <listcomp>(.0)\r\n     58         sentences, score = cap_gen.beam_search(img)\r\n     59         sentences = [' '.join([self.ix2word[idx] for idx in sent])\r\n---> 60                      for sent in sentences]\r\n     61         return sentences\r\n     62 \r\n\r\n*/PyTorch-book/chapter10-图像描述(Image Caption)/model.py in <listcomp>(.0)\r\n     57         img = self.fc(img).unsqueeze(0)\r\n     58         sentences, score = cap_gen.beam_search(img)\r\n---> 59         sentences = [' '.join([self.ix2word[idx] for idx in sent])\r\n     60                      for sent in sentences]\r\n     61         return sentences\r\n\r\nKeyError: tensor(4)"},"comment":{"url":"https://api.github.com/repos/chenyuntc/pytorch-book/issues/comments/451072993","html_url":"https://github.com/chenyuntc/pytorch-book/issues/74#issuecomment-451072993","issue_url":"https://api.github.com/repos/chenyuntc/pytorch-book/issues/74","id":451072993,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MTA3Mjk5Mw==","user":{"login":"wangdepeng1","id":44435584,"node_id":"MDQ6VXNlcjQ0NDM1NTg0","avatar_url":"https://avatars0.githubusercontent.com/u/44435584?v=4","gravatar_id":"","url":"https://api.github.com/users/wangdepeng1","html_url":"https://github.com/wangdepeng1","followers_url":"https://api.github.com/users/wangdepeng1/followers","following_url":"https://api.github.com/users/wangdepeng1/following{/other_user}","gists_url":"https://api.github.com/users/wangdepeng1/gists{/gist_id}","starred_url":"https://api.github.com/users/wangdepeng1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wangdepeng1/subscriptions","organizations_url":"https://api.github.com/users/wangdepeng1/orgs","repos_url":"https://api.github.com/users/wangdepeng1/repos","events_url":"https://api.github.com/users/wangdepeng1/events{/privacy}","received_events_url":"https://api.github.com/users/wangdepeng1/received_events","type":"User","site_admin":false},"created_at":"2019-01-03T07:43:29Z","updated_at":"2019-01-03T07:43:29Z","author_association":"NONE","body":"我想请问下，训练好的模型，给不同的图片生成的句子都是一样的，是什么原因呢？"}}
{"actor":{"display_login":"wangdepeng1"}}