class ConstantLengthDataset(IterableDataset) results infinite iteration. The reason for this is due to the exception handling part when we run out from the underlying dataset and catch the StopIteration exception. The code there:
To Reproduce
We do not need that as HF already created this code correctly just forgot to update this notebook. In this youtube video , the presented code is good. When the StopIteration is caught, the following good code is shown:
Information
The problem arises in chapter:
Describe the bug
class ConstantLengthDataset(IterableDataset) results infinite iteration. The reason for this is due to the exception handling part when we run out from the underlying dataset and catch the StopIteration exception. The code there:
To Reproduce
We do not need that as HF already created this code correctly just forgot to update this notebook. In this youtube video , the presented code is good. When the StopIteration is caught, the following good code is shown:
Expected behavior
Do not start the iteration if we just finished it otherwise it results infinit