02_production something wrong with DataBlock.dataloaders


I don’t know why but I cannot create the dataloaders from the ‘bears’ DataBlock. When I run the cell:

dls = bears.dataloaders(path)

I get the error:

Could not do one pass in your dataloader, there is something wrong in it

All previous cells run fine, and I have the bears images in place. If I run:

dls = bears.dataloaders(path, verbose=True)

Then I get:

Setting up after_item: Pipeline: Resize -- {'size': (128, 128), 'method': 'crop', 'pad_mode':
'reflection', 'resamples': (2, 0), 'p': 1.0} -> ToTensor
Setting up before_batch: Pipeline: 
Setting up after_batch: Pipeline: IntToFloatTensor -- {'div': 255.0, 'div_mask': 1}
Could not do one pass in your dataloader, there is something wrong in it

I am running the notebooks in paperspace gradient as specified in the documentation of the course.

Does anyone have a hint on what could be wrong or where to look to find the problem?

Can we see your bears DataBlock?

Yes, it is the code from lesson 2:

bear_types = 'grizzly','black','teddy'
path = Path('bears')

if not path.exists():
    for o in bear_types:
        dest = (path/o)
        results = search_images_bing(key, f'{o} bear')
        download_images(dest, urls=results.attrgot('content_url'))

bears = DataBlock(
    blocks=(ImageBlock, CategoryBlock), 
    splitter=RandomSplitter(valid_pct=0.1, seed=41),

There is another thread around the error you reported - Error while using tabular in v2. This mentions the need to install the right version of fastcore. Can you try this?

1 Like

Thanks. I restarted my gradient instance and updated fastai and that fixed the problem.

FWIW downgrading fastcore from 1.3.19 to 1.3.17 allowed me to continue.

The adult sample works with 1.2.19, so it could be my data, I need to look into it further.

[Update] Re-ran with fastcore 1.3.19 and works fine, can’t really say what changed, sorry.

1 Like