Fastai2 on Windows

thanks for quick answer!
shame i thought WSL Ubuntu will make use of GPU :frowning:
edit: link to github discussion on adding GPU support to WSL, but for now there is no timeframe set for thisā€¦ https://github.com/Microsoft/WSL/issues/829

i did try using fastai with GPU on Windows in the past but it had issues, like was very slow compared to with same GPU on linux. Probably had something do to with number of workers but also was kind of hanging in between epochs. i should give it a try now and see if things changed!

You can check this topic that I created a couple of days ago. Check out Nicolasā€™ 'blog post that he published. I didnā€™t have the chance to try yet (low priority for now).

If you are successful in doing that, please post your findings.

1 Like

That has certainly been my experience too. And I too hope to see GPU used by WSL2 sometime, but for now Iā€™ll use an Azure VM with Ubuntu and GPU.

1 Like

Thanks Miwojc, I was wondering about that; being confused enough, is enough! I shall heed your advice. Thankfully I havenā€™t purchased it yet, despite the countless drip-feed follow-ups. I remain unsure as to the depth of coverage despite the claims.
Also, I have discovered and started reading pjh and Silvanā€™s EXCELLENT BOOK - this is by far the best preparatory activity in anticipation of the course. As well, reading some (or ALL) of Rachaelā€™s work is magic.
Thanks Miwojc - some of my best friends are Polish!,
Cheers, p

1 Like

Salut,
I hope this post is rightly placed hereā€¦
I have starfted with fastai and executed the following command in the python shell:
from fastai.vision import *
from fastai.callbacks.one_cycle import *
path = untar_data(URLs.MNIST_SAMPLE)
data = ImageDataBunch.from_folder(path)
model = simple_cnn((3,16,16,2))
learn = Learner(data, model)
learn.metrics=[accuracy]
learn.fit(1)

It works fine but when I copy it into a file test.py and call python I get an error when learn.fit(1) starts.
File ā€œC:\Program Files\Python37\lib\multiprocessing\spawn.pyā€, line 136, in _check_not_importing_main
is not going to be frozen to produce an executable.ā€™ā€™ā€™)
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

I do not unxderstand why I can run code interactively but not as a python file
Ciao, mathias

2 Likes

rgs)
478 # We may need to call lazy init again if we are a forked child
479 # del _CudaBase.new
ā€“> 480 return super(_CudaBase, cls).new(cls, *args, **kwargs)
481
482

RuntimeError: CUDA error: the launch timed out and was terminated

getting this error on Window10, suspect is the dataloader num_workers issue, but I have tried to set num_workers=0, no luck yet.

Hi guys, Iā€™m trying to run the FastAI2 pets lesson 1 after installing it in a Win10 (editable install), every time I try to load the main libraries I get an error stating that: name ā€˜log_argsā€™ is not defined. Any chance anyone has some insight to provide?

from fastai2.basics import *
from fastai2.callback.all import *
from fastai2.vision.all import *
from nbdev.showdoc import *

---------------------------------------------------------------------------

NameError Traceback (most recent call last)
in
----> 1 from fastai2.basics import *
2 from fastai2.callback.all import *
3 from fastai2.vision.all import *
4 from nbdev.showdoc import *

d:\fai2\fastai2\fastai2\basics.py in
----> 1 from .data.all import *
2 from .optimizer import *
3 from .callback.core import *
4 from .learner import *
5 from .metrics import *

d:\fai2\fastai2\fastai2\data\all.py in
----> 1 from ā€¦torch_basics import *
2 from .core import *
3 from .load import *
4 from .external import *
5 from .transforms import *

d:\fai2\fastai2\fastai2\torch_basics.py in
3 from .torch_imports import *
4 from .torch_core import *
----> 5 from .layers import *

d:\fai2\fastai2\fastai2\layers.py in
271
272 # Cell
ā€“> 273 @log_args
274 @funcs_kwargs
275 class BaseLoss():

NameError: name ā€˜log_argsā€™ is not defined

I tried updating the libraries with git pull and tried importing functions in a more verbose way but I canā€™t get it to go.

If you use an editable install of fastai2, you also need an editable install of fastcore, and you have to make sure you are always updating them both together.

2 Likes

Seem to be getting the same error too. Running on Google Colab. Had been working a few days ago. Should be using the latest master because did a fresh install. Looks like that line was also changed 2 days ago.

NameError                                 Traceback (most recent call last)
<ipython-input-4-97b9dd603d64> in <module>()
----> 1 from fastai2.vision.all import *

4 frames
/usr/local/lib/python3.6/dist-packages/fastai2/layers.py in <module>()
    271 
    272 # Cell
--> 273 @log_args
    274 @funcs_kwargs
    275 class BaseLoss():

NameError: name 'log_args' is not defined
1 Like

You need to install the most recent version of fastcore along with this (the dev version ideally)

3 Likes

ah, okay got it, itā€™s working for me now. Thanks!

I downgraded pytorch to 1.2.0 as recommended. It seems working, then I update fastai2, it downgrade my fastcore and have the following error. It unstalled my fastcore, but it seems install the same version again. Any idea to fix it?
ERROR: fastai2 0.0.17 has requirement torch>=1.3.0, but youā€™ll have torch 1.2.0 which is incompatible.
ERROR: fastai2 0.0.17 has requirement torchvision>=0.5, but youā€™ll have torchvision 0.4.0 which is incompatible. I updated my fastcore and the nameError ā€˜log_argsā€™ is not definedā€™ and now this error shown up again. Current fastcore=0.1.17.

fastai requires PyTorch 1.3.1 minimum, so you need to install this version (or wait for PyTorch to release it if itā€™s not available already).
As for the log_args, itā€™s because you need to do an editable install of fastcore to go with your editable install of fastai2.

1 Like

You need to install the PyTorch 1.4 release for Windows.

1 Like

I think Windows may not be appropriate for DL practice. Although I use Windows for DL, I find it better to train the methods in Cloud or Linux environment.

OK.
I just want to clarify the following side note from Jeremy is for Colab in Window and not window in general. I will try the latest pytorch. Thanks.

A side note for windows:
Currently, pytorch==1.2.0 torchvision==0.4.0 is recomended and working (1.3.1 is not available on offical pytorch site and 1.4 is most recent but not working properly.)
In

Yes, but this a point in the topic that has not been updated in a while (this is a wiki, so if some new PyTorch versions are available on Windows, fell free to update it).

We are pinned to PyTorch 1.3.1 and torchivision 0.5.0 minimum right now, as we rely on behavior introduced in those versions. PyTorch 1.4.0 used to not work with fastai v2 but this has all been fixed now, so check you can install it properly on Windows and then edit the mentioned topic :slight_smile: .

2 Likes

As Sylvain mentioned the docs are out-dated. Here is my setup info if it helps:

fastai2 Version: 0.0.17
nbdev Version: nbdev not found
fastprogress Version: 0.2.3
fastpages Version: fastpages not found

python Version: 3.7.7 (default, Mar 23 2020, 23:19:08) [MSC v.1916 64 bit (AMD64)]
torchvision: 0.5.0
torch version: 1.4.0

I followed the directions on the github page and also installed pytorch as I have Cuda9.2 from the pytorch website: In my case: conda install pytorch torchvision cudatoolkit=9.2 -c pytorch -c defaults -c numba/label/dev

Tried to reinstall Pytorch 1.4.0, and found:
"The following specifications were found to be incompatible with your CUDA driver:

  • feature:/win-64::__cuda==10.2=0
  • feature:|@/win-64::__cuda==10.2=0

Your installed CUDA driver is: 10.2"

Need to down grade CUDA.

1 Like

I added that note and at that time it was problematic. I didnā€™t test the very recent 1.4 version pytorch. If you use conda you can install 1.3.1 with specifed version. Still you can not find 1.3.1 on the official pytorch site. You can install multiple cuda versions with the correct path naming.