{
  "id": 411547,
  "title": "Time out error on very simple model",
  "url": "/competitions/birdclef-2023/discussion/411547",
  "author_name": "",
  "post_date": "2023-05-19T16:52:51.831010800Z",
  "votes": 1,
  "comment_count": 6,
  "views": 0,
  "content": "<p>Can any one tell me how I get notebook time out when submitting a notebook using this simple model??<br>\nam I making something wrong??</p>\n<p>class TinyModel(torch.nn.Module):<br>\n    def <strong>init</strong>(self, numChannels, classes):<br>\n        # call the parent constructor<br>\n        super(TinyModel, self).<strong>init</strong>()<br>\n        # initialize first set of CONV =&gt; RELU =&gt; POOL layers<br>\n        self.conv1 = Conv2d(in_channels=3, out_channels=20,<br>\n            kernel_size=(5, 5))<br>\n        self.relu1 = ReLU()<br>\n        self.maxpool1 = MaxPool2d(kernel_size=(2, 2), stride=(2, 2))<br>\n        # initialize second set of CONV =&gt; RELU =&gt; POOL layers<br>\n        self.conv2 = Conv2d(in_channels=20, out_channels=50,<br>\n            kernel_size=(5, 5))<br>\n        self.relu2 = ReLU()<br>\n        self.maxpool2 = MaxPool2d(kernel_size=(2, 2), stride=(2, 2))</p>\n<pre><code>    self.conv3 = Conv2d(in_channels=50, out_channels=20,\n        kernel_size=(1, 1))\n    self.relu3 = ReLU()\n\n    self.fc1 = Linear(in_features=56180, out_features=5000)\n    self.relu3 = ReLU()\n\n    self.fc2 = Linear(in_features=5000, out_features=500)\n    self.relu2 = ReLU()\n\n    # initialize our softmax classifier\n    self.fc3 = Linear(in_features=500, out_features=classes)\n    self.logSoftmax = LogSoftmax(dim=1)\n\ndef forward(self, x):\n    # pass the input through our first set of CONV =&gt; RELU =&gt;\n    # POOL layers\n    x = self.conv1(x)\n    x = self.relu1(x)\n    x = self.maxpool1(x)\n    # pass the output from the previous layer through the second\n    # set of CONV =&gt; RELU =&gt; POOL layers\n    x = self.conv2(x)\n    x = self.relu2(x)\n    x = self.maxpool2(x)\n\n    x = self.conv3(x)\n    x = self.relu3(x)\n    #x = self.\n    # flatten the output from the previous layer and pass it\n    # through our only set of FC =&gt; RELU layers\n    x = flatten(x, 1)\n    x = self.fc1(x)\n    x = self.relu3(x)\n\n    x = self.fc2(x)\n    x = self.relu3(x)\n    # pass the output to our softmax classifier to get our output\n    # predictions\n    x = self.fc3(x)\n    output = self.logSoftmax(x)\n    # return the output predictions\n    return output\n</code></pre>",
  "messages": [
    {
      "id": "2266032",
      "postDate": "05/19/2023 16:52:51",
      "content": "<p>Can any one tell me how I get notebook time out when submitting a notebook using this simple model??<br>\nam I making something wrong??</p>\n<p>class TinyModel(torch.nn.Module):<br>\n    def <strong>init</strong>(self, numChannels, classes):<br>\n        # call the parent constructor<br>\n        super(TinyModel, self).<strong>init</strong>()<br>\n        # initialize first set of CONV =&gt; RELU =&gt; POOL layers<br>\n        self.conv1 = Conv2d(in_channels=3, out_channels=20,<br>\n            kernel_size=(5, 5))<br>\n        self.relu1 = ReLU()<br>\n        self.maxpool1 = MaxPool2d(kernel_size=(2, 2), stride=(2, 2))<br>\n        # initialize second set of CONV =&gt; RELU =&gt; POOL layers<br>\n        self.conv2 = Conv2d(in_channels=20, out_channels=50,<br>\n            kernel_size=(5, 5))<br>\n        self.relu2 = ReLU()<br>\n        self.maxpool2 = MaxPool2d(kernel_size=(2, 2), stride=(2, 2))</p>\n<pre><code>    self.conv3 = Conv2d(in_channels=50, out_channels=20,\n        kernel_size=(1, 1))\n    self.relu3 = ReLU()\n\n    self.fc1 = Linear(in_features=56180, out_features=5000)\n    self.relu3 = ReLU()\n\n    self.fc2 = Linear(in_features=5000, out_features=500)\n    self.relu2 = ReLU()\n\n    # initialize our softmax classifier\n    self.fc3 = Linear(in_features=500, out_features=classes)\n    self.logSoftmax = LogSoftmax(dim=1)\n\ndef forward(self, x):\n    # pass the input through our first set of CONV =&gt; RELU =&gt;\n    # POOL layers\n    x = self.conv1(x)\n    x = self.relu1(x)\n    x = self.maxpool1(x)\n    # pass the output from the previous layer through the second\n    # set of CONV =&gt; RELU =&gt; POOL layers\n    x = self.conv2(x)\n    x = self.relu2(x)\n    x = self.maxpool2(x)\n\n    x = self.conv3(x)\n    x = self.relu3(x)\n    #x = self.\n    # flatten the output from the previous layer and pass it\n    # through our only set of FC =&gt; RELU layers\n    x = flatten(x, 1)\n    x = self.fc1(x)\n    x = self.relu3(x)\n\n    x = self.fc2(x)\n    x = self.relu3(x)\n    # pass the output to our softmax classifier to get our output\n    # predictions\n    x = self.fc3(x)\n    output = self.logSoftmax(x)\n    # return the output predictions\n    return output\n</code></pre>",
      "rawMarkdown": "Can any one tell me how I get notebook time out when submitting a notebook using this simple model??\nam I making something wrong??\n\nclass TinyModel(torch.nn.Module):\n    def __init__(self, numChannels, classes):\n        # call the parent constructor\n        super(TinyModel, self).__init__()\n        # initialize first set of CONV => RELU => POOL layers\n        self.conv1 = Conv2d(in_channels=3, out_channels=20,\n            kernel_size=(5, 5))\n        self.relu1 = ReLU()\n        self.maxpool1 = MaxPool2d(kernel_size=(2, 2), stride=(2, 2))\n        # initialize second set of CONV => RELU => POOL layers\n        self.conv2 = Conv2d(in_channels=20, out_channels=50,\n            kernel_size=(5, 5))\n        self.relu2 = ReLU()\n        self.maxpool2 = MaxPool2d(kernel_size=(2, 2), stride=(2, 2))\n        \n        self.conv3 = Conv2d(in_channels=50, out_channels=20,\n            kernel_size=(1, 1))\n        self.relu3 = ReLU()\n        \n        self.fc1 = Linear(in_features=56180, out_features=5000)\n        self.relu3 = ReLU()\n        \n        self.fc2 = Linear(in_features=5000, out_features=500)\n        self.relu2 = ReLU()\n        \n        # initialize our softmax classifier\n        self.fc3 = Linear(in_features=500, out_features=classes)\n        self.logSoftmax = LogSoftmax(dim=1)\n\n    def forward(self, x):\n        # pass the input through our first set of CONV => RELU =>\n        # POOL layers\n        x = self.conv1(x)\n        x = self.relu1(x)\n        x = self.maxpool1(x)\n        # pass the output from the previous layer through the second\n        # set of CONV => RELU => POOL layers\n        x = self.conv2(x)\n        x = self.relu2(x)\n        x = self.maxpool2(x)\n        \n        x = self.conv3(x)\n        x = self.relu3(x)\n        #x = self.\n        # flatten the output from the previous layer and pass it\n        # through our only set of FC => RELU layers\n        x = flatten(x, 1)\n        x = self.fc1(x)\n        x = self.relu3(x)\n        \n        x = self.fc2(x)\n        x = self.relu3(x)\n        # pass the output to our softmax classifier to get our output\n        # predictions\n        x = self.fc3(x)\n        output = self.logSoftmax(x)\n        # return the output predictions\n        return output",
      "votes": null
    },
    {
      "id": "2266117",
      "postDate": "05/19/2023 18:09:38",
      "content": "<p>The error most likely doesn't come from your model but maybe the way you use it since there is no reason such a model ends up in a timeout, we would need to see more of your code to properly help you</p>",
      "rawMarkdown": "The error most likely doesn't come from your model but maybe the way you use it since there is no reason such a model ends up in a timeout, we would need to see more of your code to properly help you",
      "votes": null
    },
    {
      "id": "2266277",
      "postDate": "05/19/2023 21:36:54",
      "content": "<p>thank you for your reply<br>\nhere is the whole notebook <a href=\"https://colab.research.google.com/drive/1zR6AONcWBgClHr0yud0KxeEfSt87WUrf?usp=sharing\" target=\"_blank\">https://colab.research.google.com/drive/1zR6AONcWBgClHr0yud0KxeEfSt87WUrf?usp=sharing</a>, yes you pointed it right (since there is no reason such a model ends up in a timeout,) I saw people make advanced models and they work </p>",
      "rawMarkdown": "thank you for your reply\nhere is the whole notebook https://colab.research.google.com/drive/1zR6AONcWBgClHr0yud0KxeEfSt87WUrf?usp=sharing, yes you pointed it right (since there is no reason such a model ends up in a timeout,) I saw people make advanced models and they work",
      "votes": null
    },
    {
      "id": "2267256",
      "postDate": "05/20/2023 18:14:02",
      "content": "<p>Hey <a href=\"https://www.kaggle.com/mohamedantargad\" target=\"_blank\">@mohamedantargad</a>,<br>\nI recommand that instead of taking each 5 second segment like you are doing (so a tensor of shape <code>(1,num_channels,audio_lenght,frequences)</code>) and then predict for every single one of those, you should concatenate them first into a <code>(120,num_channels,audio_lenght,frequences)</code> and then predict as if it was a batch of size 120.<br>\nThat might be the reason why your code doesn't run, you'll need to make a few tweaks but overall I don't spot any mistake other than that. Good luck.</p>",
      "rawMarkdown": "Hey @mohamedantargad,\nI recommand that instead of taking each 5 second segment like you are doing (so a tensor of shape `(1,num_channels,audio_lenght,frequences)`) and then predict for every single one of those, you should concatenate them first into a `(120,num_channels,audio_lenght,frequences)` and then predict as if it was a batch of size 120.\nThat might be the reason why your code doesn't run, you'll need to make a few tweaks but overall I don't spot any mistake other than that. Good luck.",
      "votes": null
    },
    {
      "id": "2267668",
      "postDate": "05/21/2023 06:48:06",
      "content": "<p>Thank you again, I edited the notebook to make the batch of size 120 but still the same timeout error is thrown:<br>\n<a href=\"https://colab.research.google.com/drive/1w2soNvRE7JPNUqp7uOPowTCYmz1TJnSj?usp=sharing\" target=\"_blank\">https://colab.research.google.com/drive/1w2soNvRE7JPNUqp7uOPowTCYmz1TJnSj?usp=sharing</a></p>",
      "rawMarkdown": "Thank you again, I edited the notebook to make the batch of size 120 but still the same timeout error is thrown:\nhttps://colab.research.google.com/drive/1w2soNvRE7JPNUqp7uOPowTCYmz1TJnSj?usp=sharing",
      "votes": null
    },
    {
      "id": "2267841",
      "postDate": "05/21/2023 09:18:12",
      "content": "<p>Assuming the training process went smoothly, I recommend you to check out this thread:<br>\n<a href=\"https://www.kaggle.com/competitions/birdclef-2023/discussion/409331\" target=\"_blank\">Avoid Timeout by Rounding Your Model's Parameters</a></p>\n<p>There is a known issue about extremely long runtime when inferencing with denormals in the model parameters. Any solution in the thread, although slightly different, should all work.</p>",
      "rawMarkdown": "Assuming the training process went smoothly, I recommend you to check out this thread:\n[Avoid Timeout by Rounding Your Model's Parameters](https://www.kaggle.com/competitions/birdclef-2023/discussion/409331)\n\nThere is a known issue about extremely long runtime when inferencing with denormals in the model parameters. Any solution in the thread, although slightly different, should all work.",
      "votes": null
    },
    {
      "id": "2269273",
      "postDate": "05/22/2023 10:49:51",
      "content": "<p>thanks a lot, I tried one of the solutions and it worked perfectly, now I'm trying a larger model<br>\nIt's my first competition and I've already loved the community<br>\nthanks again for you help</p>",
      "rawMarkdown": "thanks a lot, I tried one of the solutions and it worked perfectly, now I'm trying a larger model\nIt's my first competition and I've already loved the community\nthanks again for you help",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2266117,
      "author_name": "janmpia",
      "author_url": "",
      "post_date": "05/19/2023 18:09:38",
      "content": "<p>The error most likely doesn't come from your model but maybe the way you use it since there is no reason such a model ends up in a timeout, we would need to see more of your code to properly help you</p>",
      "votes": null,
      "replies": [
        {
          "id": 2266277,
          "author_name": "mohamedantargad",
          "author_url": "",
          "post_date": "05/19/2023 21:36:54",
          "content": "<p>thank you for your reply<br>\nhere is the whole notebook <a href=\"https://colab.research.google.com/drive/1zR6AONcWBgClHr0yud0KxeEfSt87WUrf?usp=sharing\" target=\"_blank\">https://colab.research.google.com/drive/1zR6AONcWBgClHr0yud0KxeEfSt87WUrf?usp=sharing</a>, yes you pointed it right (since there is no reason such a model ends up in a timeout,) I saw people make advanced models and they work </p>",
          "votes": null,
          "replies": [
            {
              "id": 2267256,
              "author_name": "janmpia",
              "author_url": "",
              "post_date": "05/20/2023 18:14:02",
              "content": "<p>Hey <a href=\"https://www.kaggle.com/mohamedantargad\" target=\"_blank\">@mohamedantargad</a>,<br>\nI recommand that instead of taking each 5 second segment like you are doing (so a tensor of shape <code>(1,num_channels,audio_lenght,frequences)</code>) and then predict for every single one of those, you should concatenate them first into a <code>(120,num_channels,audio_lenght,frequences)</code> and then predict as if it was a batch of size 120.<br>\nThat might be the reason why your code doesn't run, you'll need to make a few tweaks but overall I don't spot any mistake other than that. Good luck.</p>",
              "votes": null,
              "replies": [
                {
                  "id": 2267668,
                  "author_name": "mohamedantargad",
                  "author_url": "",
                  "post_date": "05/21/2023 06:48:06",
                  "content": "<p>Thank you again, I edited the notebook to make the batch of size 120 but still the same timeout error is thrown:<br>\n<a href=\"https://colab.research.google.com/drive/1w2soNvRE7JPNUqp7uOPowTCYmz1TJnSj?usp=sharing\" target=\"_blank\">https://colab.research.google.com/drive/1w2soNvRE7JPNUqp7uOPowTCYmz1TJnSj?usp=sharing</a></p>",
                  "votes": null,
                  "replies": []
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "id": 2267841,
      "author_name": "lhanhsin",
      "author_url": "",
      "post_date": "05/21/2023 09:18:12",
      "content": "<p>Assuming the training process went smoothly, I recommend you to check out this thread:<br>\n<a href=\"https://www.kaggle.com/competitions/birdclef-2023/discussion/409331\" target=\"_blank\">Avoid Timeout by Rounding Your Model's Parameters</a></p>\n<p>There is a known issue about extremely long runtime when inferencing with denormals in the model parameters. Any solution in the thread, although slightly different, should all work.</p>",
      "votes": null,
      "replies": [
        {
          "id": 2269273,
          "author_name": "mohamedantargad",
          "author_url": "",
          "post_date": "05/22/2023 10:49:51",
          "content": "<p>thanks a lot, I tried one of the solutions and it worked perfectly, now I'm trying a larger model<br>\nIt's my first competition and I've already loved the community<br>\nthanks again for you help</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2266032": "Can any one tell me how I get notebook time out when submitting a notebook using this simple model??\nam I making something wrong??\n\nclass TinyModel(torch.nn.Module):\n    def __init__(self, numChannels, classes):\n        # call the parent constructor\n        super(TinyModel, self).__init__()\n        # initialize first set of CONV => RELU => POOL layers\n        self.conv1 = Conv2d(in_channels=3, out_channels=20,\n            kernel_size=(5, 5))\n        self.relu1 = ReLU()\n        self.maxpool1 = MaxPool2d(kernel_size=(2, 2), stride=(2, 2))\n        # initialize second set of CONV => RELU => POOL layers\n        self.conv2 = Conv2d(in_channels=20, out_channels=50,\n            kernel_size=(5, 5))\n        self.relu2 = ReLU()\n        self.maxpool2 = MaxPool2d(kernel_size=(2, 2), stride=(2, 2))\n        \n        self.conv3 = Conv2d(in_channels=50, out_channels=20,\n            kernel_size=(1, 1))\n        self.relu3 = ReLU()\n        \n        self.fc1 = Linear(in_features=56180, out_features=5000)\n        self.relu3 = ReLU()\n        \n        self.fc2 = Linear(in_features=5000, out_features=500)\n        self.relu2 = ReLU()\n        \n        # initialize our softmax classifier\n        self.fc3 = Linear(in_features=500, out_features=classes)\n        self.logSoftmax = LogSoftmax(dim=1)\n\n    def forward(self, x):\n        # pass the input through our first set of CONV => RELU =>\n        # POOL layers\n        x = self.conv1(x)\n        x = self.relu1(x)\n        x = self.maxpool1(x)\n        # pass the output from the previous layer through the second\n        # set of CONV => RELU => POOL layers\n        x = self.conv2(x)\n        x = self.relu2(x)\n        x = self.maxpool2(x)\n        \n        x = self.conv3(x)\n        x = self.relu3(x)\n        #x = self.\n        # flatten the output from the previous layer and pass it\n        # through our only set of FC => RELU layers\n        x = flatten(x, 1)\n        x = self.fc1(x)\n        x = self.relu3(x)\n        \n        x = self.fc2(x)\n        x = self.relu3(x)\n        # pass the output to our softmax classifier to get our output\n        # predictions\n        x = self.fc3(x)\n        output = self.logSoftmax(x)\n        # return the output predictions\n        return output",
    "2266117": "The error most likely doesn't come from your model but maybe the way you use it since there is no reason such a model ends up in a timeout, we would need to see more of your code to properly help you",
    "2266277": "thank you for your reply\nhere is the whole notebook https://colab.research.google.com/drive/1zR6AONcWBgClHr0yud0KxeEfSt87WUrf?usp=sharing, yes you pointed it right (since there is no reason such a model ends up in a timeout,) I saw people make advanced models and they work",
    "2267256": "Hey @mohamedantargad,\nI recommand that instead of taking each 5 second segment like you are doing (so a tensor of shape `(1,num_channels,audio_lenght,frequences)`) and then predict for every single one of those, you should concatenate them first into a `(120,num_channels,audio_lenght,frequences)` and then predict as if it was a batch of size 120.\nThat might be the reason why your code doesn't run, you'll need to make a few tweaks but overall I don't spot any mistake other than that. Good luck.",
    "2267668": "Thank you again, I edited the notebook to make the batch of size 120 but still the same timeout error is thrown:\nhttps://colab.research.google.com/drive/1w2soNvRE7JPNUqp7uOPowTCYmz1TJnSj?usp=sharing",
    "2267841": "Assuming the training process went smoothly, I recommend you to check out this thread:\n[Avoid Timeout by Rounding Your Model's Parameters](https://www.kaggle.com/competitions/birdclef-2023/discussion/409331)\n\nThere is a known issue about extremely long runtime when inferencing with denormals in the model parameters. Any solution in the thread, although slightly different, should all work.",
    "2269273": "thanks a lot, I tried one of the solutions and it worked perfectly, now I'm trying a larger model\nIt's my first competition and I've already loved the community\nthanks again for you help"
  },
  "source": "meta"
}