Lesson 1 Discussion ✅

(Siamak) #1371

Hi, I was wondering to know why when I get PosixPath from:

from pathlib import Path
xpath = Path(’/content’)

Does not have ls() method

but when I get from fastai.datapath4file(’/content’)

I have ls() method from it?

xxpath = datapath4file(’/content’)

both of them are PosixPath

(sharon woo) #1372

Hi, I just started doing this course. I’m getting this error in the Lesson 1 notebook (on a Windows 10 Anaconda environment):

b should have at least 2 dimensions, but has 1 dimensions instead

I also encountered an error for pat = r’/([^/]+)_\d+.jpg$’ but there was a fix above by @lngy00.

I couldn’t get much further than trying to download ResNet50, switched to Google Colab thanks to seeing this: https://github.com/wilsantow/Fast-AI-Deep-Learning-1/blob/master/lesson1_.ipynb

Checked the FastAI documentation and I see v1 support is only officially for Linux, explains a lot. Will explore using Linux in a bit…

(jiawenYe) #1373

probably you can try access the link by browser, even download it

(jiawenYe) #1374

I have the same issue as you, with win 10, python 3.7.2 fastai lastest.
when I run data.show_batch(rows=3, figsize=(10,10))
I got error
run time error: b should have at least 2 dimensions, but has 1 dimensions instead


i got the same issue, have you fixed it?

(Brian Smith) #1376

When you say you have the latest FastAI @yjweny1 and @sharonwoo - exactly which version? Some people have had issues updating to the latest and have been stuck with earlier versions that give errors like these. Completely removing and adding back Anaconda has helped in some cases. I’m using Win10, Python 3.7.1 and FastAI 1.0.45. Even the original ‘pat’ regex works in this version, as you can see below. Windows can be slower than Linux currently due to some multi threading issues with Pickle - but it is supported for FastAI v1.0.

(jiawenYe) #1377

Hi Brian, thank you for your reply.
I am using win10, python 3.7.1, fastai 1.0.38.
After reading your reply, I think probably my fastai version problem, and I tried conda updata fastai, but somehow, it is the lastest version I can use.
I have the issue with origin pat, I try to run your code in my jupyter notebook.

And if I use the pat in my way to fix, it shows the following problem.

Could someone help,plz.
Thank you.

(jiawenYe) #1378

@brismith, sorry I think I replied under your comment, but I am not

(Brian Smith) #1379

As I mentioned @yjweny1 - you may need to start from scratch with a fresh Anaconda install - not just try and upgrade the environment you have. That should get you up to 1.0.45. My code was just the latest lesson1 pets notebook - which was updated very recently.

(sharon woo) #1380

Hi @brismith, thanks for the informative response. I just used conda (on a Mac) to install fastai in a fresh virtual environment, and that gives me 1.0.34 which is really odd. Will check the Windows version later.

(Brian Smith) #1381

Possible Conda needs updating too - or re-install Anaconda to get it up to date.

(jiawenYe) #1382

Hi guys I think I fixed my last problem by re-install anaconda, and I have got a new problem.
When I try to run the code
from fastai.vision import *
from fastai.metrics import error_rate
it returns:

I am currently using win10, python 3.7.0 and fastai1.0.45.
Could someone help, plz
Thank you

(jiawenYe) #1383

Hi Brian
Thank you for your advise, it worked.

(Amey) #1384

When I run Line 30 of the Lesson1 Notebook I get following Error:

RuntimeError: CUDA error: no kernel image is available for execution on the device

When tried Torch first time I had also got a Warning saying OLD GPU, does that mean I can NOT run pytorch and fastai libraries on my current laptop with this NVIDIA GPU ?

    Found GPU0 Quadro K1100M which is of cuda capability 3.0.
    PyTorch no longer supports this GPU because it is too old.
  warnings.warn(old_gpu_warn % (d, name, major, capability[1]))

Error in Notebook

RuntimeError                              Traceback (most recent call last)
<ipython-input-30-66824b983385> in <module>
----> 1 data.show_batch(rows=3, figsize=(7,6))

~\Anaconda3\lib\site-packages\fastai\basic_data.py in show_batch(self, rows, ds_type, **kwargs)
    179     def show_batch(self, rows:int=5, ds_type:DatasetType=DatasetType.Train, **kwargs)->None:
    180         "Show a batch of data in `ds_type` on a few `rows`."
--> 181         x,y = self.one_batch(ds_type, True, True)
    182         n_items = rows **2 if self.train_ds.x._square_show else rows
    183         if self.dl(ds_type).batch_size < n_items: n_items = self.dl(ds_type).batch_size

~\Anaconda3\lib\site-packages\fastai\basic_data.py in one_batch(self, ds_type, detach, denorm, cpu)
    162         w = self.num_workers
    163         self.num_workers = 0
--> 164         try:     x,y = next(iter(dl))
    165         finally: self.num_workers = w
    166         if detach: x,y = to_detach(x,cpu=cpu),to_detach(y,cpu=cpu)

~\Anaconda3\lib\site-packages\fastai\basic_data.py in __iter__(self)
     73     def __iter__(self):
     74         "Process and returns items from `DataLoader`."
---> 75         for b in self.dl: yield self.proc_batch(b)
     77     @classmethod

~\Anaconda3\lib\site-packages\fastai\basic_data.py in proc_batch(self, b)
     68         "Process batch `b` of `TensorImage`."
     69         b = to_device(b, self.device)
---> 70         for f in listify(self.tfms): b = f(b)
     71         return b

~\Anaconda3\lib\site-packages\fastai\vision\data.py in _normalize_batch(b, mean, std, do_x, do_y)
     65     x,y = b
     66     mean,std = mean.to(x.device),std.to(x.device)
---> 67     if do_x: x = normalize(x,mean,std)
     68     if do_y and len(y.shape) == 4: y = normalize(y,mean,std)
     69     return x,y

~\Anaconda3\lib\site-packages\fastai\vision\data.py in normalize(x, mean, std)
     55 def normalize(x:TensorImage, mean:FloatTensor,std:FloatTensor)->TensorImage:
     56     "Normalize `x` with `mean` and `std`."
---> 57     return (x-mean[...,None,None]) / std[...,None,None]
     59 def denormalize(x:TensorImage, mean:FloatTensor,std:FloatTensor, do_x:bool=True)->TensorImage:

RuntimeError: CUDA error: no kernel image is available for execution on the device

(sharon woo) #1385

Hi @ameyv,

From the error message, my guess is that your card is no longer supported. I also had problems running this tutorial on a 1050Ti.

Perhaps you can try one of the cloud providers suggested in lecture 1? Note Jeremy mentions that he has a card with 11GB of VRAM, and that anything with less than 8GB will probably have a tough time somewhere in lecture 1 also. Unfortunately my 1050Ti only has 4GB so I ended up switching to the cloud. Hope you find something that works soon.


Hi,I have updated my fast.ai(1.046) and re-install my anaconda ,windows server 08 but it still have this bug. All of the guys says new vision has fixed it but it doesn’t work for me. Could u give me some advice, thanks.

(ZhijuePeng) #1387

I want to ask this question:
I want to use the local tar dataset : oxford-iiit-pet.tar
how can I change the code:
path = untar_data(‘D/oxford-iiit-pet.tar’); path
My internet speed is slow

(ZhijuePeng) #1388

The Dataset already downloaded in D:/oxford-iiit-pet.tar
so how can I change this code

(Sanyam Bhutani) #1389

Just do

path = Path("Path goes here")

(ZhijuePeng) #1390

Thanks for your prompt reply. :grinning: