Skip to content

notebook tests error: ./2d_registration/registration_mednist.ipynb #3347

Description

@wyli

Describe the bug

Running ./2d_registration/registration_mednist.ipynb
Checking PEP8 compliance...
Running notebook...
Before:
    "max_epochs = 200\n",
After:
    "max_epochs = 1\n",

Executing:   0%|          | 0/20 [00:00<?, ?cell/s]
Executing:   5%|▌         | 1/20 [00:01<00:24,  1.27s/cell]
Executing:  20%|██        | 4/20 [00:04<00:18,  1.14s/cell]
Executing:  30%|███       | 6/20 [00:06<00:15,  1.14s/cell]
Executing:  40%|████      | 8/20 [00:16<00:30,  2.54s/cell]
Executing:  55%|█████▌    | 11/20 [00:16<00:12,  1.43s/cell]
Executing:  55%|█████▌    | 11/20 [00:17<00:14,  1.57s/cell]
Traceback (most recent call last):
  File "/opt/conda/bin/papermill", line 8, in <module>
    sys.exit(papermill())
  File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/papermill/cli.py", line 250, in papermill
    execute_notebook(
  File "/opt/conda/lib/python3.8/site-packages/papermill/execute.py", line 122, in execute_notebook
    raise_for_execution_errors(nb, output_path)
  File "/opt/conda/lib/python3.8/site-packages/papermill/execute.py", line 234, in raise_for_execution_errors
    raise error
papermill.exceptions.PapermillExecutionError: 
---------------------------------------------------------------------------
Exception encountered at "In [6]":
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/tmp/ipykernel_2509/823736021.py in <module>
      1 check_ds = Dataset(data=training_datadict, transform=train_transforms)
----> 2 check_loader = DataLoader(check_ds, batch_size=1, shuffle=True)
      3 check_data = first(check_loader)
      4 fixed_image = check_data["fixed_hand"][0][0]
      5 moving_image = check_data["moving_hand"][0][0]

/home/jenkins/agent/workspace/Monai-notebooks/MONAI/monai/data/dataloader.py in __init__(self, dataset, num_workers, **kwargs)
     82             kwargs.update({"worker_init_fn": worker_init_fn})
     83 
---> 84         super().__init__(dataset=dataset, num_workers=num_workers, **kwargs)  # type: ignore[call-overload]

/opt/conda/lib/python3.8/site-packages/torch/utils/data/dataloader.py in __init__(self, dataset, batch_size, shuffle, sampler, batch_sampler, num_workers, collate_fn, pin_memory, drop_last, timeout, worker_init_fn, multiprocessing_context, generator, prefetch_factor, persistent_workers)
    266             else:  # map-style
    267                 if shuffle:
--> 268                     sampler = RandomSampler(dataset, generator=generator)
    269                 else:
    270                     sampler = SequentialSampler(dataset)

/opt/conda/lib/python3.8/site-packages/torch/utils/data/sampler.py in __init__(self, data_source, replacement, num_samples, generator)
    100 
    101         if not isinstance(self.num_samples, int) or self.num_samples <= 0:
--> 102             raise ValueError("num_samples should be a positive integer "
    103                              "value, but got num_samples={}".format(self.num_samples))
    104 

ValueError: num_samples should be a positive integer value, but got num_samples=0

introduced since #3332

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions