{
  "id": 395553,
  "title": "fit_generator",
  "url": "/competitions/digit-recognizer/discussion/395553",
  "author_name": "Sebastien Gac",
  "post_date": "2023-03-17T17:37:11.750000",
  "votes": 0,
  "comment_count": 0,
  "views": null,
  "content": "<p>Hi,</p>\n<p>I have a problem with \"fit_generator\". </p>\n<p>When I try to run my model, it says:<br>\n\"WARNING:tensorflow:Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least <code>steps_per_epoch * epochs</code> batches.\"</p>\n<p>I have tried to use the  method \"repeat()\" on my batches to extend my data set but with no success.<br>\nHave you met a similar problem?</p>\n<p>Thanks<br>\nSebastien</p>\n<p>Here is a piece of my code:</p>\n<p>\"batches = gen.flow(X_train, y_train, batch_size=64)<br>\nval_batches = gen.flow(X_val, y_val, batch_size=64)</p>\n<p>from tensorflow import repeat</p>\n<p>history=model.fit_generator(generator=batches.repeat(), steps_per_epoch=batches.n, epochs=3, <br>\n                    validation_data=val_batches. repeat(), validation_steps=val_batches.n)\"</p>",
  "messages": [
    {
      "id": 2186302,
      "postDate": "2023-03-17T17:37:11.750Z",
      "content": "<p>Hi,</p>\n<p>I have a problem with \"fit_generator\". </p>\n<p>When I try to run my model, it says:<br>\n\"WARNING:tensorflow:Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least <code>steps_per_epoch * epochs</code> batches.\"</p>\n<p>I have tried to use the  method \"repeat()\" on my batches to extend my data set but with no success.<br>\nHave you met a similar problem?</p>\n<p>Thanks<br>\nSebastien</p>\n<p>Here is a piece of my code:</p>\n<p>\"batches = gen.flow(X_train, y_train, batch_size=64)<br>\nval_batches = gen.flow(X_val, y_val, batch_size=64)</p>\n<p>from tensorflow import repeat</p>\n<p>history=model.fit_generator(generator=batches.repeat(), steps_per_epoch=batches.n, epochs=3, <br>\n                    validation_data=val_batches. repeat(), validation_steps=val_batches.n)\"</p>",
      "rawMarkdown": "Hi,\n\nI have a problem with \"fit_generator\". \n\nWhen I try to run my model, it says:\n\"WARNING:tensorflow:Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least `steps_per_epoch * epochs` batches.\"\n\nI have tried to use the  method \"repeat()\" on my batches to extend my data set but with no success.\nHave you met a similar problem?\n\nThanks\nSebastien\n\nHere is a piece of my code:\n\n\"batches = gen.flow(X_train, y_train, batch_size=64)\nval_batches = gen.flow(X_val, y_val, batch_size=64)\n\nfrom tensorflow import repeat\n\nhistory=model.fit_generator(generator=batches.repeat(), steps_per_epoch=batches.n, epochs=3, \n                    validation_data=val_batches. repeat(), validation_steps=val_batches.n)\""
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "2186302": "Hi,\n\nI have a problem with \"fit_generator\". \n\nWhen I try to run my model, it says:\n\"WARNING:tensorflow:Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least `steps_per_epoch * epochs` batches.\"\n\nI have tried to use the  method \"repeat()\" on my batches to extend my data set but with no success.\nHave you met a similar problem?\n\nThanks\nSebastien\n\nHere is a piece of my code:\n\n\"batches = gen.flow(X_train, y_train, batch_size=64)\nval_batches = gen.flow(X_val, y_val, batch_size=64)\n\nfrom tensorflow import repeat\n\nhistory=model.fit_generator(generator=batches.repeat(), steps_per_epoch=batches.n, epochs=3, \n                    validation_data=val_batches. repeat(), validation_steps=val_batches.n)\""
  }
}