{
  "id": 239906,
  "title": "How can beam search be used on the basis of fairseq?",
  "url": "/competitions/bms-molecular-translation/discussion/239906",
  "author_name": "",
  "post_date": "2021-05-18T02:31:17.431972200Z",
  "votes": 6,
  "comment_count": 2,
  "views": 0,
  "content": "<p><strong>The decoder part mainly refers to <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> his code is mainly based on fairseq</strong></p>\n<p><img src=\"https://i.loli.net/2021/05/18/3nqyW8MHeiv9g6Y.png\" alt=\"image.png\"></p>\n<p>After investigating fairseq, there is a case of lstm, which indicates that incremental_state needs to be rearranged to adapt to beam search. After the subsequent registration of fairseq, the command script can directly call the beam parameter.</p>\n<p><img src=\"https://i.loli.net/2021/05/18/fcTDKu1WFpgXQiG.png\" alt=\"image.png\"></p>\n<p>Therefore, I am confused in two places:<br>\n1) Can I not use fairseq's registrar mechanism and simply use the beam search feature?<br>\n2) How should I reorder the incremental_state in the transformer? When I checked the source code of ‘fairseq.models.transformer.TransformerModel’, I did not find any code for reordering.</p>\n<p>If my question is stupid, please forgive me, because I am really unfamiliar with the fairseq framework.</p>",
  "messages": [
    {
      "id": "1312360",
      "postDate": "05/18/2021 02:31:17",
      "content": "<p><strong>The decoder part mainly refers to <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> his code is mainly based on fairseq</strong></p>\n<p><img src=\"https://i.loli.net/2021/05/18/3nqyW8MHeiv9g6Y.png\" alt=\"image.png\"></p>\n<p>After investigating fairseq, there is a case of lstm, which indicates that incremental_state needs to be rearranged to adapt to beam search. After the subsequent registration of fairseq, the command script can directly call the beam parameter.</p>\n<p><img src=\"https://i.loli.net/2021/05/18/fcTDKu1WFpgXQiG.png\" alt=\"image.png\"></p>\n<p>Therefore, I am confused in two places:<br>\n1) Can I not use fairseq's registrar mechanism and simply use the beam search feature?<br>\n2) How should I reorder the incremental_state in the transformer? When I checked the source code of ‘fairseq.models.transformer.TransformerModel’, I did not find any code for reordering.</p>\n<p>If my question is stupid, please forgive me, because I am really unfamiliar with the fairseq framework.</p>",
      "rawMarkdown": "**The decoder part mainly refers to @hengck23 his code is mainly based on fairseq**\n\n![image.png](https://i.loli.net/2021/05/18/3nqyW8MHeiv9g6Y.png)\n\nAfter investigating fairseq, there is a case of lstm, which indicates that incremental_state needs to be rearranged to adapt to beam search. After the subsequent registration of fairseq, the command script can directly call the beam parameter.\n\n![image.png](https://i.loli.net/2021/05/18/fcTDKu1WFpgXQiG.png)\n\nTherefore, I am confused in two places:\n1) Can I not use fairseq's registrar mechanism and simply use the beam search feature?\n2) How should I reorder the incremental_state in the transformer? When I checked the source code of ‘fairseq.models.transformer.TransformerModel’, I did not find any code for reordering.\n\nIf my question is stupid, please forgive me, because I am really unfamiliar with the fairseq framework.",
      "votes": null
    },
    {
      "id": "1314142",
      "postDate": "05/19/2021 01:25:52",
      "content": "<p>I have same question, Maybe sequcence_generator.py has a code for reordering. But it's a bit difficult for me.</p>",
      "rawMarkdown": "I have same question, Maybe sequcence_generator.py has a code for reordering. But it's a bit difficult for me.",
      "votes": null
    },
    {
      "id": "1314230",
      "postDate": "05/19/2021 03:49:07",
      "content": "<p>google for sequcence_generator.py in fairseq github repo (there is one that uses ensemeble of models).<br>\nyou also need to overwrite a few class member functions (which i did not)</p>",
      "rawMarkdown": "google for sequcence_generator.py in fairseq github repo (there is one that uses ensemeble of models).\nyou also need to overwrite a few class member functions (which i did not)",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1314142,
      "author_name": "ultrazhl",
      "author_url": "",
      "post_date": "05/19/2021 01:25:52",
      "content": "<p>I have same question, Maybe sequcence_generator.py has a code for reordering. But it's a bit difficult for me.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1314230,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "05/19/2021 03:49:07",
      "content": "<p>google for sequcence_generator.py in fairseq github repo (there is one that uses ensemeble of models).<br>\nyou also need to overwrite a few class member functions (which i did not)</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1312360": "**The decoder part mainly refers to @hengck23 his code is mainly based on fairseq**\n\n![image.png](https://i.loli.net/2021/05/18/3nqyW8MHeiv9g6Y.png)\n\nAfter investigating fairseq, there is a case of lstm, which indicates that incremental_state needs to be rearranged to adapt to beam search. After the subsequent registration of fairseq, the command script can directly call the beam parameter.\n\n![image.png](https://i.loli.net/2021/05/18/fcTDKu1WFpgXQiG.png)\n\nTherefore, I am confused in two places:\n1) Can I not use fairseq's registrar mechanism and simply use the beam search feature?\n2) How should I reorder the incremental_state in the transformer? When I checked the source code of ‘fairseq.models.transformer.TransformerModel’, I did not find any code for reordering.\n\nIf my question is stupid, please forgive me, because I am really unfamiliar with the fairseq framework.",
    "1314142": "I have same question, Maybe sequcence_generator.py has a code for reordering. But it's a bit difficult for me.",
    "1314230": "google for sequcence_generator.py in fairseq github repo (there is one that uses ensemeble of models).\nyou also need to overwrite a few class member functions (which i did not)"
  },
  "source": "meta"
}