Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify Workflow to Allow IterableDataset Inputs #8263

Merged
merged 12 commits into from
Dec 19, 2024
Prev Previous commit
Next Next commit
Update epoch length block
Signed-off-by: Eric Kerfoot <eric.kerfoot@gmail>
  • Loading branch information
Eric Kerfoot committed Dec 18, 2024
commit 10d8c9a703273bcafbbb1385b4d5bd1c61b5fdd7
12 changes: 6 additions & 6 deletions monai/engines/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ def __init__(
def set_sampler_epoch(engine: Engine) -> None:
sampler.set_epoch(engine.state.epoch)

# if the epoch_length isn't given, attempt to get it from the length of the data loader
if epoch_length is None:
try:
epoch_length = len(data_loader)
except TypeError: # raised when data_loader is given an iterable dataset which has no length
pass # deliberately leave epoch_length as None
# if the epoch_length isn't given, attempt to get it from the length of the data loader
if epoch_length is None:
try:
epoch_length = len(data_loader)
except TypeError: # raised when data_loader has an iterable dataset with no length, or is some other type
pass # deliberately leave epoch_length as None

# set all sharable data for the workflow based on Ignite engine.state
self.state: Any = State(
Expand Down
Loading