{
  "id": 426641,
  "title": "what is best practice for handling CTC loss for infinity",
  "url": "/competitions/bengaliai-speech/discussion/426641",
  "author_name": "hengck23",
  "post_date": "2023-07-24T13:07:34.490000",
  "votes": 3,
  "comment_count": 2,
  "views": 0,
  "content": "<p>i temporarily use: model.config.ctc_zero_infinity = True</p>\n<p>I am using wave2vec hugging face model.<br>\ni check that my label length should be shorter than the length of generated input ( length of audio//320).<br>\nwhy did infinity loss occurs?</p>\n<p>what is the best practice to handle it?</p>\n<hr>\n<p>i  also find that infinity only occurs for the train split of the train csv file. For the valid split, there are no problem.</p>",
  "messages": [
    {
      "id": 2356956,
      "postDate": "2023-07-24T13:07:34.490Z",
      "content": "<p>i temporarily use: model.config.ctc_zero_infinity = True</p>\n<p>I am using wave2vec hugging face model.<br>\ni check that my label length should be shorter than the length of generated input ( length of audio//320).<br>\nwhy did infinity loss occurs?</p>\n<p>what is the best practice to handle it?</p>\n<hr>\n<p>i  also find that infinity only occurs for the train split of the train csv file. For the valid split, there are no problem.</p>",
      "rawMarkdown": "i temporarily use: model.config.ctc_zero_infinity = True\n\nI am using wave2vec hugging face model.\ni check that my label length should be shorter than the length of generated input ( length of audio//320).\nwhy did infinity loss occurs?\n\nwhat is the best practice to handle it?\n\n---\ni  also find that infinity only occurs for the train split of the train csv file. For the valid split, there are no problem.\n",
      "votes": 3
    },
    {
      "id": 2357925,
      "postDate": "2023-07-25T07:58:41.917Z",
      "content": "<blockquote>\n  <p>why did infinity loss occur?</p>\n</blockquote>\n<p>Infinite losses mainly occur when the inputs are too short to be aligned with the targets. I was stuck with this for a long time in another work, then found out a thumb rule, <strong>If your predicted sequence has a length of n, your input sequence must have a length &gt;= (2*n-1)</strong></p>\n<blockquote>\n  <p>what is the best practice to handle it?</p>\n</blockquote>\n<p>Well not sure if it's the best or not, but you can check the audios that have a shorter length than the sentence length and remove them from the training set. Since you mentioned they're only in the training data, so it shouldn't contain any problems ! </p>",
      "rawMarkdown": ">why did infinity loss occur?\n\nInfinite losses mainly occur when the inputs are too short to be aligned with the targets. I was stuck with this for a long time in another work, then found out a thumb rule, **If your predicted sequence has a length of n, your input sequence must have a length >= (2*n-1)**\n\n>what is the best practice to handle it?\n\nWell not sure if it's the best or not, but you can check the audios that have a shorter length than the sentence length and remove them from the training set. Since you mentioned they're only in the training data, so it shouldn't contain any problems ! \n\n",
      "votes": 2
    },
    {
      "id": 2357021,
      "postDate": "2023-07-24T13:53:08.130Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 2357925,
      "author_name": "Md Boktiar Mahbub Murad",
      "author_url": "",
      "post_date": "2023-07-25T07:58:41.917000",
      "content": "<blockquote>\n  <p>why did infinity loss occur?</p>\n</blockquote>\n<p>Infinite losses mainly occur when the inputs are too short to be aligned with the targets. I was stuck with this for a long time in another work, then found out a thumb rule, <strong>If your predicted sequence has a length of n, your input sequence must have a length &gt;= (2*n-1)</strong></p>\n<blockquote>\n  <p>what is the best practice to handle it?</p>\n</blockquote>\n<p>Well not sure if it's the best or not, but you can check the audios that have a shorter length than the sentence length and remove them from the training set. Since you mentioned they're only in the training data, so it shouldn't contain any problems ! </p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 2357021,
      "author_name": "",
      "author_url": "",
      "post_date": "2023-07-24T13:53:08.130000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2356956": "i temporarily use: model.config.ctc_zero_infinity = True\n\nI am using wave2vec hugging face model.\ni check that my label length should be shorter than the length of generated input ( length of audio//320).\nwhy did infinity loss occurs?\n\nwhat is the best practice to handle it?\n\n---\ni  also find that infinity only occurs for the train split of the train csv file. For the valid split, there are no problem.\n",
    "2357925": ">why did infinity loss occur?\n\nInfinite losses mainly occur when the inputs are too short to be aligned with the targets. I was stuck with this for a long time in another work, then found out a thumb rule, **If your predicted sequence has a length of n, your input sequence must have a length >= (2*n-1)**\n\n>what is the best practice to handle it?\n\nWell not sure if it's the best or not, but you can check the audios that have a shorter length than the sentence length and remove them from the training set. Since you mentioned they're only in the training data, so it shouldn't contain any problems ! \n\n",
    "2357021": ""
  }
}