Skip to content

Misleading warning when exiting iteration while loop #749

@kilianbreathnach

Description

@kilianbreathnach

I get the following warning in each epoch

Data iterator can not provide data anymore but required total number of iterations to run is not reached.

Looking into it, I see that the exception handler on #L416 for StopIteration, upon reaching the end of the data loader, sets should_exit = True. Then, on the next attempt to iterate, it goes through the except block again and it checks if the entire run is done by running self._is_done. This function checks if all iterations have been completed, not per epoch but for all epochs. Therefore, unless we are in the final epoch, this warning is shown for each epoch.

Is this the intended behaviour or have I done something wrong? I am seeing this behaviour while using an iterator that must be manually reset to the first element. I do this reset in a handler that runs on EPOCH_COMPLETED so after this loop has been exited, making the warning seemingly unavoidable through the API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions