C4W2 Lab 3: "Your input ran out of data..."

I get the following warning when running my notebook locally in PyCharm:
~/.pyenv/versions/ai_env/lib/python3.12/site-packages/keras/src/trainers/epoch_iterator.py:151: UserWarning: Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least "steps_per_epoch * epochs" batches. You may need to use the ".repeat()" function when building your dataset.

A web search suggest that it is related to these lines (29-33) inside the windowed_dataset:

    # Create batches of windows
    dataset = dataset.batch(batch_size)
    
    # Optimize the dataset for training
    dataset = dataset.cache().prefetch(1)

In Lab 2 a similar error occurs from this code block:

# Print properties of a single batch
for windows in dataset.take(1):
  print(f'data type: {type(windows)}')
  print(f'number of elements in the tuple: {len(windows)}')
  print(f'shape of first element: {windows[0].shape}')
  print(f'shape of second element: {windows[1].shape}')
2025-03-18 19:00:08.381570: W tensorflow/core/kernels/data/cache_dataset_ops.cc:914] The calling iterator did not fully read the dataset being cached. In order to avoid unexpected truncation of the dataset, the partially cached contents of the dataset  will be discarded. This can happen if you have an input pipeline similar to `dataset.cache().take(k).repeat()`. You should use `dataset.take(k).cache().repeat()` instead.
2025-03-18 19:00:08.382075: I tensorflow/core/framework/local_rendezvous.cc:405] Local rendezvous is aborting with status: OUT_OF_RANGE: End of sequence

The dataset being iterated is constructed via the same function code as in Lab 3.

I suspect the same is happening behind the scenes when running the notebook via the web interface the course provides.

My question(s) is:
The warning suggests batching/caching/fetching/taking are not constructed properly or have an improper sequence or are missing the mentioned repeat() function. Is their a better way to setup the the dataset as it pertains batching/caching/fetching/taking that cures this warning? Where is the proper placement repeat() function?

–J

you downloaded all the files?

Yes.

What file are you thinking of that would create/impact this issue?

–J

can you let me know the lab3 name?? is it ungraded lab?

also please share a screenshot of the complete error log you got.

please make sure your python version, and other module version used in assignment in course provided environment match.

You seem to have catch where the issue is, when you are running the code, while prefetching, the copied version is getting deleted before the kernel is able to read the data. this could also be due to tensorflow and keras version mismatch.

Deepti,

It is lab2 and lab3, and the assignment


.

However, consider for a moment that I have newer versions of TF et al. The question is still legitimate in the sense that we will not be using a fixed version of TF after this course and the version probably being used here is behind what is now publicly available.

I’m wondering how we can address the problem? What light can you shed on it? I am a TF neewbie. Can you provide a better explanation of what it means?

–J

codes would need to get updated based on version update as few libraries get deprecated or updated.

But in your case it could also be based on a combination of the issue I mentioned earlier as well as your local environment as your error mentions.