Oh nevermind everyone! Since I was using Anaconda Navigator I also had to select the fastai channel there before starting my Jupyter Notebook!
Problem is solved!
Oh nevermind everyone! Since I was using Anaconda Navigator I also had to select the fastai channel there before starting my Jupyter Notebook!
Problem is solved!
Lessons need a standard header that verifies installation, environment, GPU. That would eliminate some friction.
Yes, also good to let people know that both Windows 7 and 10 (and probably 8) are known to be working
Just to avoid conflicts with names.
I’m missing something you’re saying I think. I just used conda with a 2nd name
conda create --name fastai_dg --clone fastai
TypeError Traceback (most recent call last)
<ipython-input-132-2f0ea8c44a58> in <module>()
1 learner = md.dotprod_nb_learner()
----> 2 learner.fit(0.02, 1, wds=1e-6, cycle_len=1)
D:\Sync\Courses\tmp\fastai\courses\ml1\fastai\learner.py in fit(self, lrs, n_cycle, wds, **kwargs)
207 self.sched = None
208 layer_opt = self.get_layer_opt(lrs, wds)
--> 209 return self.fit_gen(self.model, self.data, layer_opt, n_cycle, **kwargs)
210
211 def warm_up(self, lr, wds=None):
D:\Sync\Courses\tmp\fastai\courses\ml1\fastai\learner.py in fit_gen(self, model, data, layer_opt, n_cycle, cycle_len, cycle_mult, cycle_save_name, use_clr, metrics, callbacks, use_wd_sched, norm_wds, wds_sched_mult, **kwargs)
154 n_epoch = sum_geom(cycle_len if cycle_len else 1, cycle_mult, n_cycle)
155 return fit(model, data, n_epoch, layer_opt.opt, self.crit,
--> 156 metrics=metrics, callbacks=callbacks, reg_fn=self.reg_fn, clip=self.clip, **kwargs)
157
158 def get_layer_groups(self): return self.models.get_layer_groups()
D:\Sync\Courses\tmp\fastai\courses\ml1\fastai\model.py in fit(model, data, epochs, opt, crit, metrics, callbacks, **kwargs)
104 i += 1
105
--> 106 vals = validate(stepper, data.val_dl, metrics)
107 if epoch == 0: print(layout.format(*names))
108 print_stats(epoch, [debias_loss] + vals)
D:\Sync\Courses\tmp\fastai\courses\ml1\fastai\model.py in validate(stepper, dl, metrics)
126 preds,l = stepper.evaluate(VV(x), VV(y))
127 loss.append(to_np(l))
--> 128 res.append([f(preds.data,y) for f in metrics])
129 return [np.mean(loss)] + list(np.mean(np.stack(res),0))
130
D:\Sync\Courses\tmp\fastai\courses\ml1\fastai\model.py in <listcomp>(.0)
126 preds,l = stepper.evaluate(VV(x), VV(y))
127 loss.append(to_np(l))
--> 128 res.append([f(preds.data,y) for f in metrics])
129 return [np.mean(loss)] + list(np.mean(np.stack(res),0))
130
D:\Sync\Courses\tmp\fastai\courses\ml1\fastai\metrics.py in <lambda>(preds, targs)
11
12 def accuracy_thresh(thresh):
---> 13 return lambda preds,targs: accuracy_multi(preds, targs, thresh)
14
15 def accuracy_multi(preds, targs, thresh):
D:\Sync\Courses\tmp\fastai\courses\ml1\fastai\metrics.py in accuracy_multi(preds, targs, thresh)
14
15 def accuracy_multi(preds, targs, thresh):
---> 16 return ((preds>thresh)==targs).float().mean()
17
~\Anaconda3\envs\fastai\lib\site-packages\torch\tensor.py in __eq__(self, other)
346
347 def __eq__(self, other):
--> 348 return self.eq(other)
349
350 def __ne__(self, other):
TypeError: eq received an invalid combination of arguments - got (torch.FloatTensor), but expected one of:
* (int value)
didn't match because some of the arguments have invalid types: (torch.FloatTensor)
* (torch.ByteTensor other)
didn't match because some of the arguments have invalid types: (torch.FloatTensor)
learner.fit(0.02, 2, wds=1e-6, cycle_len=1)
A Jupyter Widget
[ 0. 0.02014 0.11387 0.92012]
[ 1. 0.01275 0.11149 0.92124]
learner.fit(0.02, 2, wds=1e-6, cycle_len=1)
A Jupyter Widget
[ 0. 0.01681 0.11089 0.92129]
[ 1. 0.00949 0.10951 0.92223]
Exploration
learner1 = md.dotprod_nb_learner(w_adj=0)
learner1.fit(0.02, 10, wds=1e-6, cycle_len=1)
Failed to display Jupyter Widget of type HBox.
If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean that the widgets JavaScript is still loading. If this message persists, it likely means that the widgets JavaScript library is either not installed or not enabled. See the Jupyter Widgets Documentation for setup instructions.
If you're reading this message in another frontend (for example, a static rendering on GitHub or NBViewer), it may mean that your frontend doesn't currently support widgets.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-130-4772271b0e23> in <module>()
1 learner1 = md.dotprod_nb_learner(w_adj=0)
----> 2 learner1.fit(0.02, 10, wds=1e-6, cycle_len=1)
D:\Sync\Courses\tmp\fastai\courses\ml1\fastai\learner.py in fit(self, lrs, n_cycle, wds, **kwargs)
207 self.sched = None
208 layer_opt = self.get_layer_opt(lrs, wds)
--> 209 return self.fit_gen(self.model, self.data, layer_opt, n_cycle, **kwargs)
210
211 def warm_up(self, lr, wds=None):
D:\Sync\Courses\tmp\fastai\courses\ml1\fastai\learner.py in fit_gen(self, model, data, layer_opt, n_cycle, cycle_len, cycle_mult, cycle_save_name, use_clr, metrics, callbacks, use_wd_sched, norm_wds, wds_sched_mult, **kwargs)
154 n_epoch = sum_geom(cycle_len if cycle_len else 1, cycle_mult, n_cycle)
155 return fit(model, data, n_epoch, layer_opt.opt, self.crit,
--> 156 metrics=metrics, callbacks=callbacks, reg_fn=self.reg_fn, clip=self.clip, **kwargs)
157
158 def get_layer_groups(self): return self.models.get_layer_groups()
D:\Sync\Courses\tmp\fastai\courses\ml1\fastai\model.py in fit(model, data, epochs, opt, crit, metrics, callbacks, **kwargs)
104 i += 1
105
--> 106 vals = validate(stepper, data.val_dl, metrics)
107 if epoch == 0: print(layout.format(*names))
108 print_stats(epoch, [debias_loss] + vals)
D:\Sync\Courses\tmp\fastai\courses\ml1\fastai\model.py in validate(stepper, dl, metrics)
126 preds,l = stepper.evaluate(VV(x), VV(y))
127 loss.append(to_np(l))
--> 128 res.append([f(preds.data,y) for f in metrics])
129 return [np.mean(loss)] + list(np.mean(np.stack(res),0))
130
D:\Sync\Courses\tmp\fastai\courses\ml1\fastai\model.py in <listcomp>(.0)
126 preds,l = stepper.evaluate(VV(x), VV(y))
127 loss.append(to_np(l))
--> 128 res.append([f(preds.data,y) for f in metrics])
129 return [np.mean(loss)] + list(np.mean(np.stack(res),0))
130
D:\Sync\Courses\tmp\fastai\courses\ml1\fastai\metrics.py in <lambda>(preds, targs)
11
12 def accuracy_thresh(thresh):
---> 13 return lambda preds,targs: accuracy_multi(preds, targs, thresh)
14
15 def accuracy_multi(preds, targs, thresh):
D:\Sync\Courses\tmp\fastai\courses\ml1\fastai\metrics.py in accuracy_multi(preds, targs, thresh)
14
15 def accuracy_multi(preds, targs, thresh):
---> 16 return ((preds>thresh)==targs).float().mean()
17
~\Anaconda3\envs\fastai\lib\site-packages\torch\tensor.py in __eq__(self, other)
346
347 def __eq__(self, other):
--> 348 return self.eq(other)
349
350 def __ne__(self, other):
TypeError: eq received an invalid combination of arguments - got (torch.FloatTensor), but expected one of:
* (int value)
didn't match because some of the arguments have invalid types: (torch.FloatTensor)
* (torch.ByteTensor other)
didn't match because some of the arguments have invalid types: (torch.FloatTensor)
Got this type error in the ml course Lesson5 notebook. I create a new environment in Ubuntu16.04 yesterday, not sure is it related to the new update in repo…
(Solved)
In metrics.py
Change
def accuracy_multi(preds, targs, thresh):
return ((preds>thresh)==targs).float().mean()
to
def accuracy_multi(preds, targs, thresh):
return ((preds>thresh).float()==targs).float().mean()
It seems ok, but be sure everything else changes name as well, like in the various .yml
When I’m at work I constantly have to use my cell phone hotspot to circumvent the proxy in order for me to use conda or pip installation from the command line.
I already tried the proxy settings for conda and pip rendering fruitless efforts.
Could you please share some ideas on how to install the packages behind the firewall?
For some reason it appears my machine is not utilizing my GPU? My CPU runs full throttle while my GPU hovers around 3%. I tried upgrading to Cuda 9 from Cuda 8 and a reboot but no change. It worked as expected on the previous course. Any Ideas why?
I use NGrok to workaround firewalls and serve Jupyter using a domain name. Not sure if it applies to your situation.
Hi!
this is step-by-step what I did to get lesson 1 running (fastai\courses\dl1\lesson1.ipynb) on my Windows 7 machine (HP ZBook 15 G3), which features an NVIDIA Quadro M2000M with 4 GB.
Thank you for all the help in this thread, and especially to @jeremy. This post is basically a collection of what I already learned here.
Install Anaconda (Python 3.6)
Choose the option to install for “Just Me”
Install it in a Windows directory where the path does not contain any spaces or other special characters.
I installed under the default directory, which is
C:\Users\[my_user_name]\AppData\Local\Continuum\anaconda3
Install Git for Windows
Clone fastai from GitHub
Run Anaconda Prompt from your start menu, and type:
git clone https://github.com/fastai/fastai.git
Setup Python environment / install packages
I was not able to perform the “conda env update” for the reasons described by @prusswan above. In particular I get “The program can’t start because api-ms-win-core-rtlsupport-l1-2-0.dll is missing” error message.
So I installed all required packages manually. This can be done via the Anaconda GUI or via the Anaconda Prompt
Please also use the “base” environment when installing. I had the dll-problem also when doing this process with a new environment.
5.1 Anaconda GUI (more “Windows-like”…)
Start Anaconda Navigator
Click on “Enviroments” and leave the “base” environment selected
Click on “Channels” and define the following channels beside “defaults”:
Select “Not Installed” (packages) and begin searching for and installing (by clicking the box and applying) the following packages:
For the pip packages (not available from conda) you still need to go to the Anaconda Prompt and install them running the pip command:
pip install graphviz
pip install sklearn-pandas
pip install pandas_summary
pip install isoweek
pip install torchvision
pip install torchtext
5.2 Anaconda Prompt
You might as well install everything using the Anaconda Prompt (also here do not create / activate any new environment). Open Anaconda Prompt (normal user) and type:
conda install -y bcolz
conda install -y opencv
conda install -y -c fastai tqdm
conda install -y -c peterjc123 pytorch
conda install -y -c peterjc123 cuda90
conda install -y -c peterjc123 cudnn
pip install graphviz
pip install torchvision
pip install torchtext
pip install sklearn-pandas
pip install pandas_summary
pip install isoweek
Download data for cats and dogs
If you do not have wget for Windows installed and not using cygwin, just do like this:
Open the Windows Explorer and go to your home directory, then change to the fastai directory.
Create a new directory named "data"
Now open your favorite browser and paste
http://files.fast.ai/data/dogscats.zip
as URL
Download the file and move it to your new data directory
Unzip the file with the menu entry “Extract Here”
Create symbolic links
Open Anaconda Prompt as Administrator (necessary for this step): "Run as administrator"
You land in the Windows system32 directory so you need to change to your home directory, e.g.
cd C:\Users\[my_user_name]
and then:
cd \fastai\courses\dl1
You may need to remove an existing symbolic link file from the GitHub repository first:
del fastai
now:
mklink /d fastai ..\..\fastai
and:
mklink /d data ..\..\data
Launch Jupyter Notebook
In Anaconda Navigator go back to "Home"
Under Jupyter Notebook select “Launch”.
Click through to courses and then dl1 and try lesson1.ipynb.
I haven’t tried anything else than this notebook so it might be necessary to install further packages when proceeding through the lessons.
I got it all running and
torch.cuda.is_available()
as well as
torch.backends.cudnn.enabled
return True
UPDATE: running the same experiment a few times it seems GPU is being used after all! It is only used 6 - 8 % whereas CPUs are going at 100 %, but it is used…
I am using GPU-Z tool tool to monitor GPU activity and I had the same impression, that GPU seems not to being used…
Queries continue returning expected result though:
torch.cuda.is_available()
True
torch.backends.cudnn.enabled
True
torch.cuda.device_count()
1
torch.cuda.get_device_name(0)
’Quadro M2000M’
I have also noticed the process reserves memory on the gpu, but it seems odd that it cranks the CPU and hardly utilizes the GPU. In the first series of courses (pre-2018) running cats/dogs, my GPU was maxed while my CPU was relatively low/stable. I could literally feel the heat coming from the tower. I tried to re-run my old notebooks for comparison but was riddled with errors because it seems my libraries have been updated.
Looking at This thread by FourMoBro, My elapsed time for learn.fit operations seems to be inline with the others.
3 epoch - 04:07
7 epoch - 14:54
Maybe high CPU / low GPU usage is by design for these operations?
Hi @Roger, I got the same error message while the GPU is working properly. Could you step me through how to sort it? Thanks in advance.
ModuleNotFoundError: No module named 'fastai.imports'
Hi Sarada
it means your step 8 from Jeremy’s post isn’t working,
i.e. the link / symbolic link isn’t finding fastai
figure out your working directory.
go there - is there a link to “fastai” and does clicking it take you to your fastai install directory
I’m guessing not and maybe slight edits of the below will get it to work
hth
I have ~14 s/it with my 32 GB main memory, 8 CPUs, and 4 GB GPU
Hello Jeremy,
And thank you for this detailed guide. I’ve read all 99 posts in this topic and spent several hours to make it run on my Win10 with GeForce 960m.
According to comments it is required to have CUDA. It failed running torch.cuda.is_available()
with CUDA v.7.5 and now it’s running with v.9.1
My humble suggestion is to add CUDA v.9 to first post.
Second question: In the lecture video you told how to reboot remote machine to free up GPU memory. Is there any trick similar to this on Windows machine?
P.S. I’m so happy to run it locally, without cloud computing and creating several accounts and connecting credit cards to every account, that I’m happy to contribute to this topic.