{
  "id": 174019,
  "title": "FailedPreconditionError: SharedMemoryAddress expired  in Colab",
  "url": "/competitions/siim-isic-melanoma-classification/discussion/174019",
  "author_name": "",
  "post_date": "2020-08-11T20:33:06.137823800Z",
  "votes": 2,
  "comment_count": 2,
  "views": 0,
  "content": "<p>Sorry I am new to tensorflow and Colab.🙏</p>\n<p>I try to run my Kaggle TPU kernel in Colab but it shows this error:</p>\n<p><em>FailedPreconditionError: SharedMemoryAddress expired.</em></p>\n<p>Anyone have similar experience? 🙏  thanks so much</p>\n<p>(ps: The code can run in Kaggle without problem….)</p>",
  "messages": [
    {
      "id": "966993",
      "postDate": "08/11/2020 20:33:06",
      "content": "<p>Sorry I am new to tensorflow and Colab.🙏</p>\n<p>I try to run my Kaggle TPU kernel in Colab but it shows this error:</p>\n<p><em>FailedPreconditionError: SharedMemoryAddress expired.</em></p>\n<p>Anyone have similar experience? 🙏  thanks so much</p>\n<p>(ps: The code can run in Kaggle without problem….)</p>",
      "rawMarkdown": "Sorry I am new to tensorflow and Colab.🙏\n\nI try to run my Kaggle TPU kernel in Colab but it shows this error:\n\n*FailedPreconditionError: SharedMemoryAddress expired.*\n\nAnyone have similar experience? 🙏  thanks so much\n\n(ps: The code can run in Kaggle without problem....)",
      "votes": null
    },
    {
      "id": "1045775",
      "postDate": "10/11/2020 02:52:50",
      "content": "<p>Did you figure this out?</p>",
      "rawMarkdown": "Did you figure this out?",
      "votes": null
    },
    {
      "id": "1046754",
      "postDate": "10/12/2020 01:22:05",
      "content": "<p>I think I finally figured it out. I didn't realize that I was unintentionally initializing TPUs twice. This code was running twice:</p>\n<pre><code>        tpu_address = 'grpc://{}'.format(os.environ['COLAB_TPU_ADDR'])\n        resolver = tf.distribute.cluster_resolver.TPUClusterResolver(tpu_address)\n        tf.config.experimental_connect_to_cluster(resolver)\n        tf.tpu.experimental.initialize_tpu_system(resolver)\n        strategy = tf.distribute.TPUStrategy(resolver)\n</code></pre>\n<p>By ensuring I would only run it once, things worked.</p>",
      "rawMarkdown": "I think I finally figured it out. I didn't realize that I was unintentionally initializing TPUs twice. This code was running twice:\n\n```\n        tpu_address = 'grpc://{}'.format(os.environ['COLAB_TPU_ADDR'])\n        resolver = tf.distribute.cluster_resolver.TPUClusterResolver(tpu_address)\n        tf.config.experimental_connect_to_cluster(resolver)\n        tf.tpu.experimental.initialize_tpu_system(resolver)\n        strategy = tf.distribute.TPUStrategy(resolver)\n\n```\nBy ensuring I would only run it once, things worked.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1045775,
      "author_name": "carlosaguayo",
      "author_url": "",
      "post_date": "10/11/2020 02:52:50",
      "content": "<p>Did you figure this out?</p>",
      "votes": null,
      "replies": [
        {
          "id": 1046754,
          "author_name": "carlosaguayo",
          "author_url": "",
          "post_date": "10/12/2020 01:22:05",
          "content": "<p>I think I finally figured it out. I didn't realize that I was unintentionally initializing TPUs twice. This code was running twice:</p>\n<pre><code>        tpu_address = 'grpc://{}'.format(os.environ['COLAB_TPU_ADDR'])\n        resolver = tf.distribute.cluster_resolver.TPUClusterResolver(tpu_address)\n        tf.config.experimental_connect_to_cluster(resolver)\n        tf.tpu.experimental.initialize_tpu_system(resolver)\n        strategy = tf.distribute.TPUStrategy(resolver)\n</code></pre>\n<p>By ensuring I would only run it once, things worked.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "966993": "Sorry I am new to tensorflow and Colab.🙏\n\nI try to run my Kaggle TPU kernel in Colab but it shows this error:\n\n*FailedPreconditionError: SharedMemoryAddress expired.*\n\nAnyone have similar experience? 🙏  thanks so much\n\n(ps: The code can run in Kaggle without problem....)",
    "1045775": "Did you figure this out?",
    "1046754": "I think I finally figured it out. I didn't realize that I was unintentionally initializing TPUs twice. This code was running twice:\n\n```\n        tpu_address = 'grpc://{}'.format(os.environ['COLAB_TPU_ADDR'])\n        resolver = tf.distribute.cluster_resolver.TPUClusterResolver(tpu_address)\n        tf.config.experimental_connect_to_cluster(resolver)\n        tf.tpu.experimental.initialize_tpu_system(resolver)\n        strategy = tf.distribute.TPUStrategy(resolver)\n\n```\nBy ensuring I would only run it once, things worked."
  },
  "source": "meta"
}