0

I am training a cnn model to recognise images. However, I get an error when running this code:

from fastai.vision.all import *
path = untar_data(URLs.PETS)/‘images’

def is_cat(x): return x[0].isupper()
dls = ImageDataLoaders.from_name_func(
path, get_image_files(path), valid_pct=0.2, seed=42,
label_func=is_cat, item_tfms=Resize(224))

learn = cnn_learner(dls, resnet34, metrics=error_rate)
learn.fine_tune(1)

error:

During handling of the above exception, another exception occurred:
RuntimeError Traceback (most recent call last)
in
----> 1 learn.fine_tune(1)

RuntimeError: DataLoader worker (pid(s) 12456, 4440, 3268, 448) exited unexpectedly

The error happens at the last line (was a longer error but SO does not let me submit all of that). I am not running on GPU (as suggested on internet) because I havent really got how to tell jupiter notebook to do that.

Can you help? Thanks, Luigi

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Luigi87
  • 265
  • 4
  • 13

1 Answers1

1

you can add num_workers=0 Example

ImageDataLoaders.from_name_func(path, files, label_func, item_tfms=Resize(224),**num_workers=0**)
David Buck
  • 3,752
  • 35
  • 31
  • 35