Setup problems: Running the Lesson 1 Notebook

@sethiavivek2006 you need to follow the instructions on the keras site showing how to change your backend to theano

@jeremy Thanks for the reply. I have followed that and changed my backend to tensorflow as mentioned in this link.

@sethiavivek2006 hopefully you meant that you’ve changed your backend to theano ?

Seth – Are you successfully running Anaconda3 w Python3?

lin

@jeremy @lin.crampton Thanks. I was able to import keras after changing the backend to theano. Previously there was a typo and hence it didn’t work.

Hi @vshets,
Are you using Windows 10 Bash environment?
Tks

It works. Thanks!!!

I’m having an issue I’m hoping someone can help me with :

ImportError Traceback (most recent call last)
in ()
----> 1 import utils; reload(utils)
2 from utils import plots

/home/ubuntu/nbs/utils.py in ()
50
51 from vgg16 import *
—> 52 from vgg16bn import *
53 np.set_printoptions(precision=4, linewidth=100)
54

ImportError: No module named vgg16bn

even though I have vgg16bn.py from the github downloaded into ~/nbs/. I thought it might be a permissions issue, but the acl on vgg16, utils, and vgg16 are the same. I have also tried restarting the python notebook kernel. I appreciate the help!

Be sure that you are in ~/nbs when you run ‘jupyter notebook’. You can run ‘%pwd’ in a cell to check you’re in the right directory.

I fixed the issue, though I am not clear on what caused it. I’ve been connecting to aws via the aws-ssh alias where is when i applied wget to retrieve vgg16bn.py. However, this time I connected with the connect command I saved from the setup_p2.sh , and there I saw the python script was missing. I think the ip address was not stable when i do aws-get-p2 and then aws-ssh. I just remembered you mentioning this in the beginning of lesson 1, so I’ll go back and try to see what I need to do to avoid this issue in the future. Thank you for the quick response!

Hi guys, I tried running the Lesson 1 Notebook on my 2015 MBP (macOS Sierra 10.12.2)

I installed Anaconda/Theano/Keras/Python libraries this way:
Anaconda: Using the installer from https://repo.continuum.io/archive/Anaconda2-4.2.0-MacOSX-x86_64.pkg
Theano: pip install theano
Keras: pip install keras
cv2: conda install -c https://conda.binstar.org/jjhelmus opencv
bcolz: conda install bcolz

When running import utiles, I get the following error:

Googling the error doesn’t give much relevant results. Can anyone help please? Thanks

Edit: Deleted Anaconda and reinstalled using the command line installer and commands from install-gpu.sh and it works now :slight_smile:

1 Like

Hi everybody, I’m having an issue logging into the notebook.

Everything was working fine up up until the end of lesson 1. I was able to get everything setup and running; was at the point where we were unzipping the the cats and dogs files in terminal. However, somewhere during this point, the tmux window in terminal froze and I had to force close the window. I lost my session and wasn’t sure what to do, so I decided to close aws using the amazon web browser: Instances => instance state => stop, instead of using terminal. Now, when I try to log into the notebook: source aws-alias.sh => aws-start, I get the following error:

~ $ aws-start
An error occurred (InvalidParameterCombination) when calling the StartInstances operation: No instances specified

~ $ aws-ssh
ssh: Could not resolve hostname None: nodename nor servname provided, or not known

Any suggestions on how to get the notebook back up and running?

Hi @mitch15, perhaps the $instanceId is missing so aws-start couldn’t work. Try running
~ $ aws-get-p2

OR

~ $ aws-get-t2 (if you’re running t2)

and then try

~ $ aws-start again

2 Likes

Thank you so much @davidtan36, it’s up and running again. Any idea why the $instanceId would go missing like that?

If you see the code for aws-start, alias aws-get-p2='export instanceId=`aws...., you can see that $instanceId is only defined when aws-start is run.

To make it persist, after you run aws-start, take the output, eg if the output is ‘i-9aa9c282’, open ~/.bashrc and add the line ‘export instanceId=i-9aa9c282’ and save it.

Future terminal sessions will have instanceId defined.

1 Like

@davidtan36 I was having a similar problem importing utils. I’m not sure about your particular error, but it was mentioned in another thread that if you comment out “import cv2” and “from keras.callbacks import ReduceLROnPlateau” from the utils.py file it’ll work no problem. They were left in the code from an earlier version.

1 Like

@mitch15 I tried but it doesn’t seem to work. It seems to be an issue specific to bcolz. Thanks anyway!

1 Like

Thanks

SUB: NEED HELP TO SETUP THEANO/KERAS TO USE ALL CORES OF CPU.

Hi,

I intend to use my local windows machine for working on small sample datasets and use the AWS GPU server for final runs in order to keep my AWS costs low.

Finally, I have successfully run Lesson 1 notebook on both Windows and AWS after fixing the initial few errors. On a 1000+ images dataset, my windows laptop executes the VGG.fit() statement in 3 hours Vs the AWS GPU doing it on all 22000 images in about 10 minutes!

My problem is that although the windows machine is a multicore CPU, the python/theano/keras uses only one core. I did set the environment variable OMP_NUM_THREADS=7, hoping that it will make all 7 cores get utilized.

Is there anyway to decrease the time taken on a CPU by making it run parallel on all cores? I understand it will still be 10X the time taken on a GPU, but should be useful for trying code on a sample dataset.

Any suggestions would be appreciated

UPDATE

I finally managed to get it to run in parallel using all available cores. Had to add the following line to the python notebook.

theano.config.openmp = True

1 Like