508635 (4) [Avatar] Offline
#1
Hello,

First of all, thanks very much for the book and the R package to Keras and tensorflow. I tried to work through Appendix B of the book and the RStudio instruction site to set up deep learning instance in AWS EC2. I had to make tweaks in a few places to get things working. I have cataloged what I did in the following Rmd file (in case it is useful for somebody else).
https://github.com/notesofdabbler/Scratch/blob/master/deeplearning_with_R_ec2_setup.Rmd

Summary of tweaks that I did are:
1. The Appendix points to Deep Learning AMI (Ubuntu version) and the RStudio site points to Deep Learning AMI (Amazon Linux version). It looks like apt-get commands don't work in Amazon Linux version. But I was able to use the Ubuntu version.
2. I added the step of associating CRAN mirror prior to installing R to ensure that the latest version of R is installed.
3. Deep Learning AMI has conda environments for tensorflow/keras with CUDA-8. So I had to modify the CUDA path to explicitly use cuda-8.0
4. Once I was in RStudio session, I needed to add the /home/ubuntu/anaconda3/bin path since I was logged in as a different user. Otherwise the use_condaenv("tensorflow_p36") command was giving an error that the conda binary was missing.

I also noticed that the RStudio instruction site (https://tensorflow.rstudio.com/tools/cloud_gpu.html) for cloud tools doesn't seem accessible through any link from RStudio tensorflow tools site (https://tensorflow.rstudio.com/tools/). It would be great if there is a easy link to follow to cloud tools site.

Thanks,
Shankar
256385 (24) [Avatar] Offline
#2
Thanks for the feedback! I changed the link on the cloud_gpu page to point to the Ubuntu image. We are indeed going to link to that page from the "Tools" overview page just as soon as I get time to do it after the holidays.

When I tested the AMI a ways back things worked without the conda environment tweaks, perhaps a newer version of the AMI came out that introduced these requirements? It's a huge bummer that all of that extra configuration is required -- I guess anything we print in the book is bound to have obsolescence risk. We actually recently published an AMI with R, RStudio, and the tidyverse which I think is a better starting point: https://aws.amazon.com/marketplace/pp/B0785SXYB2


508635 (4) [Avatar] Offline
#3
Thanks for pointing me to the recently published AMI. It worked great. I just launched it with default settings and was immediately able to run the getting started with Keras code without any problems.

Regarding Appendix B, you are right that it is hard to keep things in print updated. I am wondering whether it is just sufficient to list the RStudio instructions URL instead of putting the instructions in print in Appendix B. That way, even if somebody gets the book later, they will always go the URL listed in the book which will have the most upto date version.
256385 (24) [Avatar] Offline
#4
I've updated the appendix with all of your edits so it now works as intended out of the box. One thing which I think will remain tricky for users is that when TF 1.5 comes out it may require CUDA 9.0 (thus invalidating the CUDA instructions we've printed). I added a note about checking the TF website for the latest CUDA requirement and substituting CUDA 9 for CUA 8 but these may still be confusing and error prone. I think your idea about just linking to a web page with current instructions is a good one.
508635 (4) [Avatar] Offline
#5
Thanks very much for the updates.
534468 (2) [Avatar] Offline
#6
Hi,

First of all - thanks to authors for a great book. Wow, exactly the book I need to put in the hands of toe dippers within Deep Learning. And great that R was chosen as the base language for all examples.
I believe this Appendix B is very important, as we must make it extremely easy to get started on AWS. And as much as I have managed to run all examples on my local Macbook I just cannot get it working on an AWS...

First I had some major issues which I tracked down to locale issues as my local locale is swedish, and something messy happened when SSH to the AWS machine. (finally fixed by adding the row LC_ALL="en_US.UTF-8" to /etc/environment [sudo nano /etc/environment ].


But I just have not found a way past this following Pythonesque issue. In Rstudio:
Sys.setenv(PATH=paste("/home/ubuntu/anaconda3/bin",Sys.getenv("PATH"),sep=":"))
reticulate::use_condaenv("tensorflow_p36")
library(keras)
mnist <- dataset_mnist()

Error in py_call_impl(callable, dots$args, dots$keywords) : Exception: URL fetch failure on https://s3.amazonaws.com/img-datasets/mnist.npz: None — unknown url type: https


Nothing really to do with your fine book, just maybe a place where others will be stuck. And I guess they'll firstly check this forum post. I'm at least stuck here.

Big thanks for any pointers.

(Also adding a huge thanks for the best typo so far; End of the great explanations in 5.1.1 “To downsample feature maps, instead of strides, we tend to use the max-pooing operation, which you saw in action in the first convnet example. Let’s look at it in more depth.”)
508635 (4) [Avatar] Offline
#7

When I set up AWS, I got the same error that you listed above when running the command to get mnist data. But for some reason, when I tried running the same code after some time, it worked. So I don't know the cause for why it happened but it seems to work for me now.

534468 (2) [Avatar] Offline
#8
Hi.

Big thanks for replying.
I got it all working AFTER I ran
install_keras()
from within RStudio.

Just so I don't spread wrong info downstream my end.
Am I doing the below correct and everything will be connected correctly within the AWS-EC2?

After the above command is typed and a Restart of R within Rstudio I run
library(keras)
Sys.setenv(PATH=paste("/home/ubuntu/anaconda3/bin",Sys.getenv("PATH"),sep=":"))
reticulate::use_condaenv("tensorflow_p36")

And now finally
mnist <- dataset_mnist()
runs just fine.