{
  "id": 398594,
  "title": "Updated Google Base Model: Runs Faster Everywhere",
  "url": "/competitions/birdclef-2023/discussion/398594",
  "author_name": "",
  "post_date": "2023-03-30T20:01:30.996175200Z",
  "votes": 9,
  "comment_count": 7,
  "views": 0,
  "content": "<p>Hi, all!</p>\n<p>We've released a new version of the <a href=\"https://www.kaggle.com/models/google/bird-vocalization-classifier\" target=\"_blank\">Google Bird Vocalization Classifier</a>. The only change is that it runs about 2x faster.  The TFLite model run time with 4 threads reduced from ~260ms to 120ms on my home machine (CPU only). We're also seeing about a 40% speedup on GPU and TPU for the original Jax model, which I expect should be similar for the exported TF SavedModel.</p>\n<p>Note that BirdNet still runs about twice as fast, once you account for the difference in window sizes (3s vs 5s).</p>\n<p>We reduced some over-computation in the spectrogram, trained up a new version of the model from scratch with the new spectrogram settings, and checked that there's no regressions on all of our existing annotated soundscape datasets. <em>(well, except the Kenyan data, of course. :) )</em></p>\n<p>Happy hacking!</p>",
  "messages": [
    {
      "id": "2203449",
      "postDate": "03/30/2023 20:01:30",
      "content": "<p>Hi, all!</p>\n<p>We've released a new version of the <a href=\"https://www.kaggle.com/models/google/bird-vocalization-classifier\" target=\"_blank\">Google Bird Vocalization Classifier</a>. The only change is that it runs about 2x faster.  The TFLite model run time with 4 threads reduced from ~260ms to 120ms on my home machine (CPU only). We're also seeing about a 40% speedup on GPU and TPU for the original Jax model, which I expect should be similar for the exported TF SavedModel.</p>\n<p>Note that BirdNet still runs about twice as fast, once you account for the difference in window sizes (3s vs 5s).</p>\n<p>We reduced some over-computation in the spectrogram, trained up a new version of the model from scratch with the new spectrogram settings, and checked that there's no regressions on all of our existing annotated soundscape datasets. <em>(well, except the Kenyan data, of course. :) )</em></p>\n<p>Happy hacking!</p>",
      "rawMarkdown": "Hi, all!\n\nWe've released a new version of the [Google Bird Vocalization Classifier](https://www.kaggle.com/models/google/bird-vocalization-classifier). The only change is that it runs about 2x faster.  The TFLite model run time with 4 threads reduced from ~260ms to 120ms on my home machine (CPU only). We're also seeing about a 40% speedup on GPU and TPU for the original Jax model, which I expect should be similar for the exported TF SavedModel.\n\nNote that BirdNet still runs about twice as fast, once you account for the difference in window sizes (3s vs 5s).\n\nWe reduced some over-computation in the spectrogram, trained up a new version of the model from scratch with the new spectrogram settings, and checked that there's no regressions on all of our existing annotated soundscape datasets. *(well, except the Kenyan data, of course. :) )*\n\nHappy hacking!",
      "votes": null
    },
    {
      "id": "2204211",
      "postDate": "03/31/2023 12:20:30",
      "content": "<p>Thanks for the updated faster model Tom!!! That is great!</p>",
      "rawMarkdown": "Thanks for the updated faster model Tom!!! That is great!",
      "votes": null
    },
    {
      "id": "2211179",
      "postDate": "04/05/2023 21:15:34",
      "content": "<p><a href=\"https://www.kaggle.com/tomdenton\" target=\"_blank\">@tomdenton</a>  Thanks for sharing this update. Any idea how to run with batch, and not one by one sample ? I tried to run on small batch (N, 5*32000) but it raise some error related to signature </p>",
      "rawMarkdown": "tomdenton  Thanks for sharing this update. Any idea how to run with batch, and not one by one sample ? I tried to run on small batch (N, 5*32000) but it raise some error related to signature",
      "votes": null
    },
    {
      "id": "2211188",
      "postDate": "04/05/2023 21:32:02",
      "content": "<p>Hi, Shiro!</p>\n<p>Unfortunately, exporting with polymorphic shape support from jax can be difficult, so I don't have a good option for batched support at this time. On the somewhat-mitigating-if-not-actually-bright side, iterating over the batch and running sequentially should be about the same when executing on CPU.</p>",
      "rawMarkdown": "Hi, Shiro!\n\nUnfortunately, exporting with polymorphic shape support from jax can be difficult, so I don't have a good option for batched support at this time. On the somewhat-mitigating-if-not-actually-bright side, iterating over the batch and running sequentially should be about the same when executing on CPU.",
      "votes": null
    },
    {
      "id": "2214185",
      "postDate": "04/08/2023 08:16:35",
      "content": "<p>Hi Tom! <br>\nthank for the reply. I will investigate if we can use it for a \"feature extractor\" inside a TPU pipeline to train a MLP then!</p>",
      "rawMarkdown": "Hi Tom! \nthank for the reply. I will investigate if we can use it for a \"feature extractor\" inside a TPU pipeline to train a MLP then!",
      "votes": null
    },
    {
      "id": "2214305",
      "postDate": "04/08/2023 10:52:08",
      "content": "<p><a href=\"https://www.kaggle.com/tomdenton\" target=\"_blank\">@tomdenton</a>  Does the jax checkpoint are available somewhere?</p>",
      "rawMarkdown": "tomdenton  Does the jax checkpoint are available somewhere?",
      "votes": null
    },
    {
      "id": "2214662",
      "postDate": "04/08/2023 16:37:52",
      "content": "<p>BTW: A really nice thing about fixed embeddings is that you can pre-compute them and experiment freely for cheap - similar to precomputing spectrograms.</p>",
      "rawMarkdown": "BTW: A really nice thing about fixed embeddings is that you can pre-compute them and experiment freely for cheap - similar to precomputing spectrograms.",
      "votes": null
    },
    {
      "id": "2214667",
      "postDate": "04/08/2023 16:40:11",
      "content": "<p>We're a bit reticent to release the Jax checkpoints because it creates a really nasty support problem - if there are code changes it can cause Jax checkpoint loading to fail, and then we'll need to include lots of overhead for backwards compatibility with old checkpoints. Exporting to TF + TFLite lets us totally decouple inference from the training pipeline.</p>",
      "rawMarkdown": "We're a bit reticent to release the Jax checkpoints because it creates a really nasty support problem - if there are code changes it can cause Jax checkpoint loading to fail, and then we'll need to include lots of overhead for backwards compatibility with old checkpoints. Exporting to TF + TFLite lets us totally decouple inference from the training pipeline.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2204211,
      "author_name": "gusthema",
      "author_url": "",
      "post_date": "03/31/2023 12:20:30",
      "content": "<p>Thanks for the updated faster model Tom!!! That is great!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 2211179,
      "author_name": "ludovick",
      "author_url": "",
      "post_date": "04/05/2023 21:15:34",
      "content": "<p><a href=\"https://www.kaggle.com/tomdenton\" target=\"_blank\">@tomdenton</a>  Thanks for sharing this update. Any idea how to run with batch, and not one by one sample ? I tried to run on small batch (N, 5*32000) but it raise some error related to signature </p>",
      "votes": null,
      "replies": [
        {
          "id": 2211188,
          "author_name": "tomdenton",
          "author_url": "",
          "post_date": "04/05/2023 21:32:02",
          "content": "<p>Hi, Shiro!</p>\n<p>Unfortunately, exporting with polymorphic shape support from jax can be difficult, so I don't have a good option for batched support at this time. On the somewhat-mitigating-if-not-actually-bright side, iterating over the batch and running sequentially should be about the same when executing on CPU.</p>",
          "votes": null,
          "replies": [
            {
              "id": 2214185,
              "author_name": "ludovick",
              "author_url": "",
              "post_date": "04/08/2023 08:16:35",
              "content": "<p>Hi Tom! <br>\nthank for the reply. I will investigate if we can use it for a \"feature extractor\" inside a TPU pipeline to train a MLP then!</p>",
              "votes": null,
              "replies": [
                {
                  "id": 2214662,
                  "author_name": "tomdenton",
                  "author_url": "",
                  "post_date": "04/08/2023 16:37:52",
                  "content": "<p>BTW: A really nice thing about fixed embeddings is that you can pre-compute them and experiment freely for cheap - similar to precomputing spectrograms.</p>",
                  "votes": null,
                  "replies": []
                }
              ]
            },
            {
              "id": 2214305,
              "author_name": "ludovick",
              "author_url": "",
              "post_date": "04/08/2023 10:52:08",
              "content": "<p><a href=\"https://www.kaggle.com/tomdenton\" target=\"_blank\">@tomdenton</a>  Does the jax checkpoint are available somewhere?</p>",
              "votes": null,
              "replies": [
                {
                  "id": 2214667,
                  "author_name": "tomdenton",
                  "author_url": "",
                  "post_date": "04/08/2023 16:40:11",
                  "content": "<p>We're a bit reticent to release the Jax checkpoints because it creates a really nasty support problem - if there are code changes it can cause Jax checkpoint loading to fail, and then we'll need to include lots of overhead for backwards compatibility with old checkpoints. Exporting to TF + TFLite lets us totally decouple inference from the training pipeline.</p>",
                  "votes": null,
                  "replies": []
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2203449": "Hi, all!\n\nWe've released a new version of the [Google Bird Vocalization Classifier](https://www.kaggle.com/models/google/bird-vocalization-classifier). The only change is that it runs about 2x faster.  The TFLite model run time with 4 threads reduced from ~260ms to 120ms on my home machine (CPU only). We're also seeing about a 40% speedup on GPU and TPU for the original Jax model, which I expect should be similar for the exported TF SavedModel.\n\nNote that BirdNet still runs about twice as fast, once you account for the difference in window sizes (3s vs 5s).\n\nWe reduced some over-computation in the spectrogram, trained up a new version of the model from scratch with the new spectrogram settings, and checked that there's no regressions on all of our existing annotated soundscape datasets. *(well, except the Kenyan data, of course. :) )*\n\nHappy hacking!",
    "2204211": "Thanks for the updated faster model Tom!!! That is great!",
    "2211179": "tomdenton  Thanks for sharing this update. Any idea how to run with batch, and not one by one sample ? I tried to run on small batch (N, 5*32000) but it raise some error related to signature",
    "2211188": "Hi, Shiro!\n\nUnfortunately, exporting with polymorphic shape support from jax can be difficult, so I don't have a good option for batched support at this time. On the somewhat-mitigating-if-not-actually-bright side, iterating over the batch and running sequentially should be about the same when executing on CPU.",
    "2214185": "Hi Tom! \nthank for the reply. I will investigate if we can use it for a \"feature extractor\" inside a TPU pipeline to train a MLP then!",
    "2214305": "tomdenton  Does the jax checkpoint are available somewhere?",
    "2214662": "BTW: A really nice thing about fixed embeddings is that you can pre-compute them and experiment freely for cheap - similar to precomputing spectrograms.",
    "2214667": "We're a bit reticent to release the Jax checkpoints because it creates a really nasty support problem - if there are code changes it can cause Jax checkpoint loading to fail, and then we'll need to include lots of overhead for backwards compatibility with old checkpoints. Exporting to TF + TFLite lets us totally decouple inference from the training pipeline."
  },
  "source": "meta"
}