Hi, Im trying to run lesson 2 on VSCode with an Ubuntu WSL2, and I’m getting weird errors.
I have a fresh virtual environment with python 3.7.
I have a folder structure as in the lesson 2 lab with images already downloaded.
After running
!pip3 install -Uqq fastbook
import fastbook
fastbook.setup_book()
from fastai.vision.widgets import *
from fastbook import *
path = Path('bears')
fns = get_image_files(path)
failed = verify_images(fns)
failed.map(Path.unlink)
sports_data_block = DataBlock(
blocks=(ImageBlock, CategoryBlock),
get_items=get_image_files,
splitter=RandomSplitter(valid_pct=0.2, seed=42),
get_y=parent_label,
item_tfms=Resize(128))
dls = sports_data_block.dataloaders(path)
dls.valid.show_batch(max_n=4, nrows=1)
I get the following error:
Could not do one pass in your dataloader, there is something wrong in it
RuntimeError: Could not infer dtype of PILImage
and a long traceback to line 137 of fastai/torch_core.py
Could someone help with this please? I have no idea what’s wrong. Since the same code works on Google Colab, I assume this is an environment or version issue.