{
  "id": 103149,
  "title": "Random training results",
  "url": "/competitions/aptos2019-blindness-detection/discussion/103149",
  "author_name": "",
  "post_date": "2019-08-07T13:55:03.248749400Z",
  "votes": null,
  "comment_count": 1,
  "views": 0,
  "content": "<p>Hi,</p>\n\n<p>I'm trying to measure the performance of my models.\nI use k-fold validation and I reset every seed before each training run to make sure that I receive consistent results.</p>\n\n<p>```\ndef seed_everything(seed=999):</p>\n\n<pre><code>random.seed(seed)\nos.environ['PYTHONHASHSEED'] = str(seed)\nnp.random.seed(seed)\ntf.set_random_seed(seed)\n</code></pre>\n\n<p>```</p>\n\n<p>Despite of these efforts that results are still different after each training run.</p>\n\n<p>Any suggestion, how to make training more deterministic?</p>",
  "messages": [
    {
      "id": "594053",
      "postDate": "08/07/2019 13:55:03",
      "content": "<p>Hi,</p>\n\n<p>I'm trying to measure the performance of my models.\nI use k-fold validation and I reset every seed before each training run to make sure that I receive consistent results.</p>\n\n<p>```\ndef seed_everything(seed=999):</p>\n\n<pre><code>random.seed(seed)\nos.environ['PYTHONHASHSEED'] = str(seed)\nnp.random.seed(seed)\ntf.set_random_seed(seed)\n</code></pre>\n\n<p>```</p>\n\n<p>Despite of these efforts that results are still different after each training run.</p>\n\n<p>Any suggestion, how to make training more deterministic?</p>",
      "rawMarkdown": "Hi,\n\nI'm trying to measure the performance of my models.\nI use k-fold validation and I reset every seed before each training run to make sure that I receive consistent results.\n\n```\ndef seed_everything(seed=999):\n    \n    random.seed(seed)\n    os.environ['PYTHONHASHSEED'] = str(seed)\n    np.random.seed(seed)\n    tf.set_random_seed(seed)\n\n```\n\nDespite of these efforts that results are still different after each training run.\n\nAny suggestion, how to make training more deterministic?",
      "votes": null
    },
    {
      "id": "594381",
      "postDate": "08/07/2019 23:09:54",
      "content": "<p>if your using pytorch, you're not setting cudnn to be deterministic. Also tf/keras doesn't support deterministic results so you will always have variations \nSee <a href=\"https://www.youtube.com/watch?v=Ys8ofBeR2kA\">https://www.youtube.com/watch?v=Ys8ofBeR2kA</a></p>",
      "rawMarkdown": "if your using pytorch, you're not setting cudnn to be deterministic. Also tf/keras doesn't support deterministic results so you will always have variations \nSee https://www.youtube.com/watch?v=Ys8ofBeR2kA",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 594381,
      "author_name": "sidhanthholalkere",
      "author_url": "",
      "post_date": "08/07/2019 23:09:54",
      "content": "<p>if your using pytorch, you're not setting cudnn to be deterministic. Also tf/keras doesn't support deterministic results so you will always have variations \nSee <a href=\"https://www.youtube.com/watch?v=Ys8ofBeR2kA\">https://www.youtube.com/watch?v=Ys8ofBeR2kA</a></p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "594053": "Hi,\n\nI'm trying to measure the performance of my models.\nI use k-fold validation and I reset every seed before each training run to make sure that I receive consistent results.\n\n```\ndef seed_everything(seed=999):\n    \n    random.seed(seed)\n    os.environ['PYTHONHASHSEED'] = str(seed)\n    np.random.seed(seed)\n    tf.set_random_seed(seed)\n\n```\n\nDespite of these efforts that results are still different after each training run.\n\nAny suggestion, how to make training more deterministic?",
    "594381": "if your using pytorch, you're not setting cudnn to be deterministic. Also tf/keras doesn't support deterministic results so you will always have variations \nSee https://www.youtube.com/watch?v=Ys8ofBeR2kA"
  },
  "source": "meta"
}