{
  "id": 499713,
  "title": "Training and Inference Notebooks (0.65 - 0.66 Single Model)",
  "url": "/competitions/birdclef-2024/discussion/499713",
  "author_name": "",
  "post_date": "2024-05-02T18:31:57.933160100Z",
  "votes": 13,
  "comment_count": 15,
  "views": 0,
  "content": "<p>Based on experiments of <a href=\"https://www.kaggle.com/lihaoweicvch\" target=\"_blank\">@lihaoweicvch</a> discussed <a href=\"https://www.kaggle.com/competitions/birdclef-2024/discussion/497539\" target=\"_blank\">here</a>. <br>\nI've prepared training and inference notebook to continue from there. </p>\n<p>Training Notebook: <a href=\"https://www.kaggle.com/code/salmanahmedtamu/training-0-65-0-66/notebook\" target=\"_blank\">https://www.kaggle.com/code/salmanahmedtamu/training-0-65-0-66/notebook</a><br>\nInference Notebook: <a href=\"https://www.kaggle.com/code/salmanahmedtamu/new-torch-jit-submission-nf\" target=\"_blank\">https://www.kaggle.com/code/salmanahmedtamu/new-torch-jit-submission-nf</a></p>\n<p>Note: Please install libraries if they are missing in training notebook.</p>",
  "messages": [
    {
      "id": "2789620",
      "postDate": "05/02/2024 18:31:57",
      "content": "<p>Based on experiments of <a href=\"https://www.kaggle.com/lihaoweicvch\" target=\"_blank\">@lihaoweicvch</a> discussed <a href=\"https://www.kaggle.com/competitions/birdclef-2024/discussion/497539\" target=\"_blank\">here</a>. <br>\nI've prepared training and inference notebook to continue from there. </p>\n<p>Training Notebook: <a href=\"https://www.kaggle.com/code/salmanahmedtamu/training-0-65-0-66/notebook\" target=\"_blank\">https://www.kaggle.com/code/salmanahmedtamu/training-0-65-0-66/notebook</a><br>\nInference Notebook: <a href=\"https://www.kaggle.com/code/salmanahmedtamu/new-torch-jit-submission-nf\" target=\"_blank\">https://www.kaggle.com/code/salmanahmedtamu/new-torch-jit-submission-nf</a></p>\n<p>Note: Please install libraries if they are missing in training notebook.</p>",
      "rawMarkdown": "Based on experiments of @lihaoweicvch discussed [here](https://www.kaggle.com/competitions/birdclef-2024/discussion/497539). \nI've prepared training and inference notebook to continue from there. \n\nTraining Notebook: https://www.kaggle.com/code/salmanahmedtamu/training-0-65-0-66/notebook\nInference Notebook: https://www.kaggle.com/code/salmanahmedtamu/new-torch-jit-submission-nf\n\nNote: Please install libraries if they are missing in training notebook.",
      "votes": null
    },
    {
      "id": "2789699",
      "postDate": "05/02/2024 19:23:10",
      "content": "<p>Thank you for sharing! For how many epochs did you train this model, 100?</p>",
      "rawMarkdown": "Thank you for sharing! For how many epochs did you train this model, 100?",
      "votes": null
    },
    {
      "id": "2789799",
      "postDate": "05/02/2024 20:24:50",
      "content": "<p>I used the model at 18th epoch for inference notebook.</p>",
      "rawMarkdown": "I used the model at 18th epoch for inference notebook.",
      "votes": null
    },
    {
      "id": "2789857",
      "postDate": "05/02/2024 21:25:33",
      "content": "<p>Did you have these functions out there somewhere? from metrics import calculate_competition_metrics, metrics_to_string, calculate_competition_metrics_no_map</p>",
      "rawMarkdown": "Did you have these functions out there somewhere? from metrics import calculate_competition_metrics, metrics_to_string, calculate_competition_metrics_no_map",
      "votes": null
    },
    {
      "id": "2790079",
      "postDate": "05/03/2024 03:12:40",
      "content": "<p>Yeah theses functions just calculate ROC, CMAP and put values in a string for the logs.</p>",
      "rawMarkdown": "Yeah theses functions just calculate ROC, CMAP and put values in a string for the logs.",
      "votes": null
    },
    {
      "id": "2790781",
      "postDate": "05/03/2024 10:32:43",
      "content": "<p>I am very curious what local scores you get with this setup? I could not see that in your notebook.</p>",
      "rawMarkdown": "I am very curious what local scores you get with this setup? I could not see that in your notebook.",
      "votes": null
    },
    {
      "id": "2791251",
      "postDate": "05/03/2024 15:03:58",
      "content": "<p>Its in the notebook. Please scroll down and you will see 2nd or 3rd cell with the logs.</p>",
      "rawMarkdown": "Its in the notebook. Please scroll down and you will see 2nd or 3rd cell with the logs.",
      "votes": null
    },
    {
      "id": "2791957",
      "postDate": "05/04/2024 00:45:12",
      "content": "<p>Nice work!</p>",
      "rawMarkdown": "Nice work!",
      "votes": null
    },
    {
      "id": "2792011",
      "postDate": "05/04/2024 03:20:30",
      "content": "<p>Nice work! When I try to submit the results, I get a Submission Scoring Error in submission. Do you know why?</p>",
      "rawMarkdown": "Nice work! When I try to submit the results, I get a Submission Scoring Error in submission. Do you know why?",
      "votes": null
    },
    {
      "id": "2792017",
      "postDate": "05/04/2024 03:24:56",
      "content": "<p>The model itself is not shared. If you want to submit this notebook you would need to alter the training notebook to run and train it first.</p>",
      "rawMarkdown": "The model itself is not shared. If you want to submit this notebook you would need to alter the training notebook to run and train it first.",
      "votes": null
    },
    {
      "id": "2792027",
      "postDate": "05/04/2024 03:31:23",
      "content": "<p>I have modified his notebook and trained my own model. But failed at the last step.</p>",
      "rawMarkdown": "I have modified his notebook and trained my own model. But failed at the last step.",
      "votes": null
    },
    {
      "id": "2804270",
      "postDate": "05/09/2024 23:21:32",
      "content": "<p>Thank you for sharing your notebook! I edited your training and inference code to add some functions and ran it; my score was 0.61. Were there any crucial points that helped you achieve a score between 0.65 and 0.66? It seems that the output from the training notebook, which is in .bin format, is not used directly in the inference code that requires a .pt file. I would appreciate it if you could share any tips!</p>",
      "rawMarkdown": "Thank you for sharing your notebook! I edited your training and inference code to add some functions and ran it; my score was 0.61. Were there any crucial points that helped you achieve a score between 0.65 and 0.66? It seems that the output from the training notebook, which is in .bin format, is not used directly in the inference code that requires a .pt file. I would appreciate it if you could share any tips!",
      "votes": null
    },
    {
      "id": "2804306",
      "postDate": "05/10/2024 00:40:11",
      "content": "<p>Same question here. I can only get LB score 0.62 by using this notebook. </p>",
      "rawMarkdown": "Same question here. I can only get LB score 0.62 by using this notebook.",
      "votes": null
    },
    {
      "id": "2804324",
      "postDate": "05/10/2024 01:31:23",
      "content": "<blockquote>\n  <p>It seems that the output from the training notebook, which is in .bin format, is not used directly in the inference code that requires a .pt file.</p>\n</blockquote>\n<p>I think it's converted to torchscript format, like this :</p>\n<p>model_scripted = torch.jit.script(model) # Export to TorchScript<br>\nmodel_scripted.save('model_scripted_00.pt')</p>\n<p>I'm not sure if the author has a different way to do the conversion</p>",
      "rawMarkdown": "> It seems that the output from the training notebook, which is in .bin format, is not used directly in the inference code that requires a .pt file.\n\nI think it's converted to torchscript format, like this :\n\nmodel_scripted = torch.jit.script(model) # Export to TorchScript\nmodel_scripted.save('model_scripted_00.pt')\n\nI'm not sure if the author has a different way to do the conversion",
      "votes": null
    },
    {
      "id": "2815636",
      "postDate": "05/16/2024 02:30:12",
      "content": "<p>Thank you for sharing your notebook! I want to know why you process the output with sigmoid function. Softmax will be all right.<br>\ne.g. <br>\n<code>for row_id_idx, row_id in enumerate(row_ids):\n    prediction_dict[str(row_id)].append(output[row_id_idx, :].sigmoid().detach().numpy())\n</code></p>",
      "rawMarkdown": "Thank you for sharing your notebook! I want to know why you process the output with sigmoid function. Softmax will be all right.\ne.g. \n`for row_id_idx, row_id in enumerate(row_ids):\n    prediction_dict[str(row_id)].append(output[row_id_idx, :].sigmoid().detach().numpy())\n`",
      "votes": null
    },
    {
      "id": "2815672",
      "postDate": "05/16/2024 03:04:15",
      "content": "<p>This one is a multilabel competition. Each example can have multiple labels. Hence Sigmoid based approaches. </p>",
      "rawMarkdown": "This one is a multilabel competition. Each example can have multiple labels. Hence Sigmoid based approaches.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2789699,
      "author_name": "snnclsr",
      "author_url": "",
      "post_date": "05/02/2024 19:23:10",
      "content": "<p>Thank you for sharing! For how many epochs did you train this model, 100?</p>",
      "votes": null,
      "replies": [
        {
          "id": 2789799,
          "author_name": "salmanahmedtamu",
          "author_url": "",
          "post_date": "05/02/2024 20:24:50",
          "content": "<p>I used the model at 18th epoch for inference notebook.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 2789857,
      "author_name": "cody11null",
      "author_url": "",
      "post_date": "05/02/2024 21:25:33",
      "content": "<p>Did you have these functions out there somewhere? from metrics import calculate_competition_metrics, metrics_to_string, calculate_competition_metrics_no_map</p>",
      "votes": null,
      "replies": [
        {
          "id": 2790079,
          "author_name": "salmanahmedtamu",
          "author_url": "",
          "post_date": "05/03/2024 03:12:40",
          "content": "<p>Yeah theses functions just calculate ROC, CMAP and put values in a string for the logs.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 2790781,
      "author_name": "tolgakopar",
      "author_url": "",
      "post_date": "05/03/2024 10:32:43",
      "content": "<p>I am very curious what local scores you get with this setup? I could not see that in your notebook.</p>",
      "votes": null,
      "replies": [
        {
          "id": 2791251,
          "author_name": "salmanahmedtamu",
          "author_url": "",
          "post_date": "05/03/2024 15:03:58",
          "content": "<p>Its in the notebook. Please scroll down and you will see 2nd or 3rd cell with the logs.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 2791957,
      "author_name": "lihaoweicvch",
      "author_url": "",
      "post_date": "05/04/2024 00:45:12",
      "content": "<p>Nice work!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 2792011,
      "author_name": "shawntung",
      "author_url": "",
      "post_date": "05/04/2024 03:20:30",
      "content": "<p>Nice work! When I try to submit the results, I get a Submission Scoring Error in submission. Do you know why?</p>",
      "votes": null,
      "replies": [
        {
          "id": 2792017,
          "author_name": "cody11null",
          "author_url": "",
          "post_date": "05/04/2024 03:24:56",
          "content": "<p>The model itself is not shared. If you want to submit this notebook you would need to alter the training notebook to run and train it first.</p>",
          "votes": null,
          "replies": [
            {
              "id": 2792027,
              "author_name": "shawntung",
              "author_url": "",
              "post_date": "05/04/2024 03:31:23",
              "content": "<p>I have modified his notebook and trained my own model. But failed at the last step.</p>",
              "votes": null,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 2804270,
      "author_name": "kmatsu01",
      "author_url": "",
      "post_date": "05/09/2024 23:21:32",
      "content": "<p>Thank you for sharing your notebook! I edited your training and inference code to add some functions and ran it; my score was 0.61. Were there any crucial points that helped you achieve a score between 0.65 and 0.66? It seems that the output from the training notebook, which is in .bin format, is not used directly in the inference code that requires a .pt file. I would appreciate it if you could share any tips!</p>",
      "votes": null,
      "replies": [
        {
          "id": 2804306,
          "author_name": "sjtuwangshuo",
          "author_url": "",
          "post_date": "05/10/2024 00:40:11",
          "content": "<p>Same question here. I can only get LB score 0.62 by using this notebook. </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 2804324,
          "author_name": "nyleve",
          "author_url": "",
          "post_date": "05/10/2024 01:31:23",
          "content": "<blockquote>\n  <p>It seems that the output from the training notebook, which is in .bin format, is not used directly in the inference code that requires a .pt file.</p>\n</blockquote>\n<p>I think it's converted to torchscript format, like this :</p>\n<p>model_scripted = torch.jit.script(model) # Export to TorchScript<br>\nmodel_scripted.save('model_scripted_00.pt')</p>\n<p>I'm not sure if the author has a different way to do the conversion</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 2815636,
      "author_name": "jonneryr",
      "author_url": "",
      "post_date": "05/16/2024 02:30:12",
      "content": "<p>Thank you for sharing your notebook! I want to know why you process the output with sigmoid function. Softmax will be all right.<br>\ne.g. <br>\n<code>for row_id_idx, row_id in enumerate(row_ids):\n    prediction_dict[str(row_id)].append(output[row_id_idx, :].sigmoid().detach().numpy())\n</code></p>",
      "votes": null,
      "replies": [
        {
          "id": 2815672,
          "author_name": "salmanahmedtamu",
          "author_url": "",
          "post_date": "05/16/2024 03:04:15",
          "content": "<p>This one is a multilabel competition. Each example can have multiple labels. Hence Sigmoid based approaches. </p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2789620": "Based on experiments of @lihaoweicvch discussed [here](https://www.kaggle.com/competitions/birdclef-2024/discussion/497539). \nI've prepared training and inference notebook to continue from there. \n\nTraining Notebook: https://www.kaggle.com/code/salmanahmedtamu/training-0-65-0-66/notebook\nInference Notebook: https://www.kaggle.com/code/salmanahmedtamu/new-torch-jit-submission-nf\n\nNote: Please install libraries if they are missing in training notebook.",
    "2789699": "Thank you for sharing! For how many epochs did you train this model, 100?",
    "2789799": "I used the model at 18th epoch for inference notebook.",
    "2789857": "Did you have these functions out there somewhere? from metrics import calculate_competition_metrics, metrics_to_string, calculate_competition_metrics_no_map",
    "2790079": "Yeah theses functions just calculate ROC, CMAP and put values in a string for the logs.",
    "2790781": "I am very curious what local scores you get with this setup? I could not see that in your notebook.",
    "2791251": "Its in the notebook. Please scroll down and you will see 2nd or 3rd cell with the logs.",
    "2791957": "Nice work!",
    "2792011": "Nice work! When I try to submit the results, I get a Submission Scoring Error in submission. Do you know why?",
    "2792017": "The model itself is not shared. If you want to submit this notebook you would need to alter the training notebook to run and train it first.",
    "2792027": "I have modified his notebook and trained my own model. But failed at the last step.",
    "2804270": "Thank you for sharing your notebook! I edited your training and inference code to add some functions and ran it; my score was 0.61. Were there any crucial points that helped you achieve a score between 0.65 and 0.66? It seems that the output from the training notebook, which is in .bin format, is not used directly in the inference code that requires a .pt file. I would appreciate it if you could share any tips!",
    "2804306": "Same question here. I can only get LB score 0.62 by using this notebook.",
    "2804324": "> It seems that the output from the training notebook, which is in .bin format, is not used directly in the inference code that requires a .pt file.\n\nI think it's converted to torchscript format, like this :\n\nmodel_scripted = torch.jit.script(model) # Export to TorchScript\nmodel_scripted.save('model_scripted_00.pt')\n\nI'm not sure if the author has a different way to do the conversion",
    "2815636": "Thank you for sharing your notebook! I want to know why you process the output with sigmoid function. Softmax will be all right.\ne.g. \n`for row_id_idx, row_id in enumerate(row_ids):\n    prediction_dict[str(row_id)].append(output[row_id_idx, :].sigmoid().detach().numpy())\n`",
    "2815672": "This one is a multilabel competition. Each example can have multiple labels. Hence Sigmoid based approaches."
  },
  "source": "meta"
}