In lesson 7 – I am getting the error ‘Exception: It’s not possible to apply those transforms to your dataset:’ object has no attribute ‘apply_tfms’" while executing code;
I have the same issue when calling get_data(bs,size).
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~\Miniconda3\lib\site-packages\fastai\data_block.py in _check_kwargs(ds, tfms, **kwargs)
580 x = ds[0]
--> 581 try: x.apply_tfms(tfms, **kwargs)
582 except Exception as e:
AttributeError: 'WindowsPath' object has no attribute 'apply_tfms'
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last)
<ipython-input-39-1e99d4dbbccc> in <module>
----> 1 data_gen = get_data(bs,size)
<ipython-input-38-6368e247f676> in get_data(bs, size)
1 def get_data(bs,size):
2 data = (src.label_from_func(lambda x: path_hr/x.name)
----> 3 .transform(get_transforms(max_zoom=2.), size=size, tfm_y=True)
4 .databunch(bs=bs).normalize(imagenet_stats, do_y=True))
5
~\Miniconda3\lib\site-packages\fastai\data_block.py in transform(self, tfms, **kwargs)
491 if not tfms: tfms=(None,None)
492 assert is_listy(tfms) and len(tfms) == 2, "Please pass a list of two lists of transforms (train and valid)."
--> 493 self.train.transform(tfms[0], **kwargs)
494 self.valid.transform(tfms[1], **kwargs)
495 if self.test: self.test.transform(tfms[1], **kwargs)
~\Miniconda3\lib\site-packages\fastai\data_block.py in transform(self, tfms, tfm_y, **kwargs)
709 _check_kwargs(self.x, tfms, **kwargs)
710 if tfm_y is None: tfm_y = self.tfm_y
--> 711 if tfm_y: _check_kwargs(self.y, tfms, **kwargs)
712 self.tfms,self.tfmargs = tfms,kwargs
713 self.tfm_y,self.tfms_y,self.tfmargs_y = tfm_y,tfms,kwargs
~\Miniconda3\lib\site-packages\fastai\data_block.py in _check_kwargs(ds, tfms, **kwargs)
581 try: x.apply_tfms(tfms, **kwargs)
582 except Exception as e:
--> 583 raise Exception(f"It's not possible to apply those transforms to your dataset:\n {e}")
584
585 class LabelList(Dataset):
Exception: It's not possible to apply those transforms to your dataset:
'WindowsPath' object has no attribute 'apply_tfms'
Per the Crestle admin I followed the below steps and for now lesson 7 (gan) is working fine.
Start your instance
Sign in to Crestle and click on Start Jupyter. The instance should take a min or two to spin up. Your previous work will be automatically loaded.
Update the course repo
To update the course repo, you will need to be in terminal. On the ‘Jupyter Notebook’ button, launch a new terminal from the jupyter notebook menu.
This should give you the latest of the course notebooks. If you modified some of the notebooks in course-v3/nbs directly, GitHub will probably throw you an error. You should type git stash to remove your local changes. Remember you should always work on a copy of the lesson notebooks.
Update the fastai library
To update the fastai library, open the terminal like before and type:
Stop your instance
Once you’re finished navigate back to the dashboard tab and click Stop Jupyter
It’s not enough to just close your browser or turn off your own computer.
Thanks for your reply. Yes, I realised I needed a double Image list. I think I got confused by API changes for some of the functions and didn’t update the code correctly.