-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Amazon Machine Instance (AMI) on EC2 #5
Comments
A fresher AMI for Caffe with Cuda 7 is described below along with the script to create it: |
Hi @beniz, I have built an EC2 AMI with deepdetectv0.1, but I have not yet managed to access the server via internet, just as you have described in your tutorial on localhost:someport from another terminal. I am pretty sure that I did security groups on AWS right (e.g. simply allowing all traffic from my IP for the moment). Any hint for me how I have to start ./main/dede -host ? -port XYZ or how this might be configured? |
OK got it: ./main/dede -host 0.0.0.0 -port XYZ |
Thanks @revilokeb this is good news. Will you be able to share both the recipe to create the image and the image itself ? |
No prob, can do this. But first would like to check that everything is working as it should, will post it here in a few days. |
I have put together a public AWS AMI with CUDA 7, cuDNN2 and deepdetect v0.1 in EU (Ireland) with ID ami-4c00423b. Be aware that this AMI can only be found in EU (Ireland), no other geolocation, but you might copy it to any other that has got g2.2xlarge instances. When instantiating the AMI you might restrict your security group to the relevant IPs and one TCP port XXXX. If you would like to access the API via Internet remember to either attach an elastic IP to your instance or choose "Auto assign Public IP" 'Enable'. Having logged into the instance you might then start deepdetect by cd ~/deepdetect/build; ./main/dede -host 0.0.0.0 -port XXXX Now from your local machine you might open a browser and past http://YYY.YYY.YYY.YYY:XXXX/info into the browser (YYY.YYY.YYY.YYY obviously being public IP of your AWS instance) - or use curl as in the docs. You should see something like (in case you are worried about libdc1394 error - see e.g. there: https://groups.google.com/forum/#!topic/digits-users/uvQpHooD6WY) |
@revilokeb thanks, this is again great news! If you agree, I will share your message on the dedicated thread on the caffe-users mailing list as this was a direct user request. |
@beniz sure go ahead, I will also provide step-by-step instructions when I have time |
I have made available another public AWS AMI with CUDA 7, cuDNN2 and deepdetect on latest commit (8b196e7..., as of Sep 1 15) in EU (Ireland) with ID ami-91092ee6. I am going to remove the previous AMI with ID ami-4c00423b soon. For those who would like building it themselves the steps are straightforward and as follows:
If you are running into problems use the above AMI or drop a note. |
This is a placeholder comment to assert that current AMI found on some servers are out of date and should not be used until there's new ones available. |
I have created a new publicly available AWS AMI in EU (Ireland) with ID ami-0564d876 that has got deepdetect commit 8d30a5e on ubuntu 14.04, CUDA 7.5 and cuDNN v4 installed. As compared to a simple install I have in addition performed the first steps of setting up an imagenet classifier (http://www.deepdetect.com/tutorials/imagenet-classifier/), i.e. I have already done the following:
The AWS AMI allows anyone to directly start a GoogleNet classification service on the 1000 ILSVRC categories in the possibly simplest manner one can think of and at almost no cost as follows:
You are done! Now you can use the service with any jpg you like as follows (from your EC2 instance): Just insert the URL of the images that you want to query instead of http://i.ytimg.com/vi/0vxOhd4qlnA/maxresdefault.jpg All the above is directly taken from http://www.deepdetect.com/tutorials/imagenet-classifier/, I have only added information when describing how to start and access the Amazon AMI that I have made publicly available. What does the fun cost? g2.2xlarge in Irleand cost $0.702 per hour (https://aws.amazon.com/de/ec2/pricing/). Executing the above will take less than 15min, if you are doing it for the first time maybe 30min. Then there is still a bit of time left to query other images, enjoy a little bit of deep learning and the fast API Server while staying below 1 USD cost (you can possibly do it even at a tenth of that cost if you are going for spot instances...) |
wow, this is dope thanks :) How could we help you have the AMI generated automatically after every new commit on |
@revilokeb Note that there's a front user interface in JS available from the repo in |
This is awesome! Building the AMI could possibly be done using packer, as part of a simple CI configuration. |
@beniz good point, I will definitely look into automation of making the AMI. BTW, a while ago I tried nginx and as you mention it is not difficult at all to do. But I could as well put it onto the AMI in one of the next AMI versions so that users just have to perform a minimal number of steps |
To the AMI that I have build and made available yesterday I have added support for all big residual nets (50, 101, 152), this is available as another publicly available AWS AMI with ID ami-7b00bc08 in EU (Ireland). So anyone could now run a classification service on GPU on the 1000 ILSVRC categories using the ILSVRC 2015 winning net of 152 layers (http://arxiv.org/abs/1512.03385) simply by using the above steps and then starting the service as follows: Starting the service for 152-layer residual net: (for 50-layer or 101-layer net just replace any 152 by 101 or 50) Predictions can then be done as before: Running the very deep residual nets on the 4GB GPUs of g2.2xlarge for predictions is achieved by reducing the batch size in deploy.prototxt to 4 (101, 152) / 8 (50). For example when predicting with the 152-layer residual net nvidia-smi shows a GPU Memory Usage of 3115MB. Network weight files have been taken from https://github.com/KaimingHe/deep-residual-networks, license (MIT) has been added. |
@revilokeb dope comes back :) This is great again, thanks! |
@ankon Tried Packer for automating AMI build, but so far not successful: hashicorp/packer#3365, for some reason Packer build produces linker error in the very last build step of deepdetect (while manual build with identical steps starting at identical AMI has got no such problems). If you happen to have an idea what could be behind it let me know... |
@revilokeb as you have noted in the packer issue, this is classic error message from not having the
I'm not familiar with packer but maybe you could add the line above to the configuration file https://gist.github.com/revilokeb/d9d90998edd7c1dc6ac7 that you have pointed to ? |
@beniz Yes, had done this yesterday without success, but re-did it now and: it is working. Shame on me. Probably did some typo or whatever. Anyway, thanks so much ;-) (this does however not really solve the more fundamental packer issue with paths as far as I can see, however I will update that issue, too) So the process could now be automated. As every build is incurring costs for instantiating a GPU instance at AWS I would suggest to build a fresh AMI at reasonable time intervals, say every week. I could do this if you want and make the AMI publicly available. If you would like having it build more often I could of course provide you with all pieces of information so that you do it on an AWS account of your own. What do you think? Second question is what exactly should be on the AMI? The AMI that I had manually build a month ago had googlenet and residual nets readily available for prediction. You have brought up the frontend which could also be setup easily. Anything else that could make sense for a potential user of such AMI to have readily available? Some ideas:
|
Thanks, this is highly welcome. Is
enough to build the whole thing ? I do confess I have not yet spent any time with packer.
I would certainly appreciate if you can update the AMI at your own pace as of right now, and there's no doubt that we'll move the process onto our side in a close future, with more timely updates. The full recipe is always welcome.
Maybe some of the models from http://www.deepdetect.com/applications/model/ could be of interest. Among the often requested ones are the
Sure, there's a way to do this easily if you are interested. When building with unit tests (
It is kind of partially available now, see https://github.com/smichalowski/google_inception_v3_for_caffe. If this is of interest to you, you can open a dedicated issue for having inception v3 provided as a template. If you have the ability to help with reviewing the |
I have now setup a weekly cron to create a fresh AMI with most recent deepdetect master each week on Sun, 11pm. In addition the AMI has the following features:
You might find the publicly available AMI in EU ireland (eu-west-1), AMI name is "deepdetect_revilokeb_{{timestamp}}", where {{timestamp}} is the UNIX timestamp of the build time. So if you want the most recent built, then take the one with the highest timestamp (I will typically leave one or two previous versions publicly available). The first automatically generated AMI today has got AMI name deepdetect_revilokeb_1458665864 (ami-d79f1ba4), I have removed all manually build ones from before. How to use the user interface:
How to use other image models: - example for gender classification (others can be used similarly)
Other service can be set up in exactly the same way, only differences are as follows:
How to use english sentiment model:
For lack of time I havent tested all the above models (but I have run a few plausibility checks on gender, clothing, bags, buildings, english_sentiment). I case there is an error lurking somewhere please drop a note. I will publish the steps how to automatically create those AMIs as soon as I have time. If there is a good idea what could be usefully added to the AMI let me know... Remarks:
|
@revilokeb outstanding work, thank you! If you don't mind we'll link AMI users to your last comment for the time being but we'll monitor and help take care of any demand for help, issues, etc... Would you have any data and insights that would help users of the AMI regarding:
Regarding the JS frontend, it should need to be patched in order to work properly with the non-Imagenet models. Are you using it for your own purpose by any chance ? Reason I'm asking is that we have a patch for making it work with potentially any model but we could target it a bit better with some user feedback. The patch has been on hold for awhile so it might be time to put it out. Well noted the remarks, the Englisth sentiment model is rough, definitely best used for finetuning on similar or other tasks, and average for sentiment, though I had a user report it is on par with some other models based on social media data. Let me know if there are elements we can help with. |
Instance Types: Other instance types at AWS (except for some previous generation CG1 instances) currently do not have GPU. The AMIs I am preparing here have appropriate NVIDIA drivers, CUDA 7.5 toolkit and cuDNN v4 installed, and compile deepdetect with CUDA and cuDNN. Therefore if someone chooses to instantiate the AMI on a non-GPU instance (e.g. such as m3.xlarge) there will be errors when doing prediction (independent of setting setting service to CPU or GPU by e.g. "mllib":{"gpu":true}). Errors will look as follows when doing prediction: {"status":{"code":500,"msg":"InternalError","dd_code":1007,"dd_msg":"src/caffe/layers/cudnn_conv_layer.cpp:52 / Check failed (custom): (error) == (cudaSuccess)"}} Thus it makes only sense to instantiate the AMI with either g2.2xlarge or g2.8xlarge. As the latter is much more expensive this only makes sense if you make good use of multi-GPU, e.g. by training on multi-GPU or running many services at the same time and spreading them to different GPUs (the latter I havent tried so far). Performance: On CPU - single image from wikipedia On GPU - single image from wikipedia On CPU - multiple images from wikipedia On GPU - multiple images from wikipedia You can drive the above times down a lot by e.g. hosting your image server in the proximity of your server running deepdetect (given this is possible for your task). This can be achieved on AWS e.g. by placing your deepdetect server and your image server into an AWS placement group (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html). In such a setup I have achieved the following times for some custom-trained googlenet 2014: Frontend: |
Excellent, thank you very much. It is a very thorough review, it's good to see that the software appears to be useful to you. My attempt to bring some more information on some points and discuss some others is below.
This is something we rely on daily: the
This sounds good to me. There still might be a slight overhead due to the server. I'm interested to know whether this can be a bottleneck in practice. Not sure where it exactly stands wrt pure Caffe to be very honest.
This is a very good point. I believe it should deserve a dedicated ticket and that someone on our side could take care of. This could go along with a pure JS client btw, which is something on our roadmap. Measuring practical needs such as this one is useful to us in order to prioritize some of the planned features. Our main JS developer is soon to get back to the world of diapers, but will see who can jump in.
Were you using dd for multi-label regression ? If yes, there are several ways to achieve this, and only one is actually supported, so any feedback is welcome.
Have you looked at https://github.com/beniz/deepdetect/tree/master/demo/imgsearch by any chance already ? Having a similar (or same, but configurable) UI as the one targeted at image classification but for this similarity search purpose is something that has been suggested. It should be pretty straightforward, and if you have code to share, it could prove useful. Don't hesitate if you have any remarks on image similarity search, its accuracy and packaging. |
@revilokeb, hi! Interested in the recipe for AMI, and moving forward when you have time to share. |
@beniz sure you are right, I am a bit behind, Ill try posting everything on the weekend. I think what we need is a complete step-by-step guide starting at the standard Ubuntu AMI available at AWS, right? This would allow users to do two things, either set up deepdetect from scratch or automate the process and do what I am currently doing when building the deepdetect AMI incl. those models which are immediately usable. |
@revilokeb yes, and from there are good chances we modify and push this onto the AWS marketplace to get a dedicated landing page + spread the image onto more datacenters. My understanding is that users would benefit from a quick 1-click install as well. Let me know your thoughts btw. |
@beniz I would definitely agree that 1-click install from most important regions might help some users. I would expect that the most important benefits from such AMIs comprise the following:
I assume users dealing with 2 and/or 3 don't desperately need the AMI, they might be happy with a good docu. If on the other hand you have no GPU machine readily available I believe the AMI can indeed be of substantial help. I would assume that users belonging to that group start exploring by setting up some predictive service (here the pre-trained models on the current AMI might help a lot), then would love to try some useful frontend. After having played a bit I would assume that the next step is solving a problem of your own by means of finetuning a pre-trained net on your own n-class dataset. So I could imagine that facilitating such network finetuning on own datatset by making it as much out-of-the box as possible might be helpful. Not 100% sure though. What do you think? Who do you think is looking for such AMI? And what is she looking for? Here is the shell script I am running each Sunday evening from crontab: https://gist.github.com/revilokeb/9ea39cac9df1e1e8044c49b5aa4b0637 This obviously requires that packer (https://www.packer.io/downloads.html) and aws cli (http://docs.aws.amazon.com/cli/latest/userguide/installing.html) are both installed. Also aws cli needs to be appropriately configured with ACCESS_KEY and SECRET_ACCESS_KEY: http://docs.aws.amazon.com/cli/latest/reference/configure/. The shell script needs the following packer template: https://gist.github.com/revilokeb/bb6b18a9f3a42405af5286de84c168a5 I will provide a description how to build the base AMI hopefully over the week. If there are any ideas how to improve those scripts or the whole setup, happy to learn! |
hi @revilokeb thanks again for sharing this very useful piece of work!
I believe your use cases 1 to 3 do actually cover most users. Most of dd recurrent users appear to be companies on a variety of markets. Easy install of the last software version with ready-to-use API endpoint and, as you suggested, some surrounding tools, some of which either we are working on or helping contributors with (1), are key elements I believe. As is scaling, for 2 and 3, accomodating the training/re-training of models, and prediction pics. We would also like to extend the offer for useful models, and having a 1-click install + drop-in new/on-demand model repository to work with would greatly ease setup, which is in line with our aim, making deep learning a commodity. (1) there's a tool under dev for continuous integration of model iterations & development as well as for visualization of training metrics, let me know if you are interested in joining this conversation as well. |
Hi Emmanuel, sharing your above view. Happy to join conversation on tool for continuous integration and visualization of training metrics. |
@revilokeb this is the repo @beniz has mentioned: I'm working on it and fixing stuff, any comments and/or help will be greatly appreaciated |
@Isaacpm thanks I will have a look, give it a try and comment. Btw, I have inadvertently deleted above AMI deepdetect_base_160322 (ami-4f9f1b3c) which is necessary to perform my weekly builds (just for info so that people are not looking for it), so this cant be found for the moment. It is however not necessary for instantiating and running deepdetect on AWS (there is a build from yesterday night: ami-950d8ee6). I will rebuild the base and document necessary steps along the way which were still missing anyway. I am thinking to move the AWS related docu to some other place as this issue here is probably getting difficult to follow / understand. |
@revilokeb having with the steps documented would be great. You should have access to the wiki at https://github.com/beniz/deepdetect/wiki as a place where to move the related documentation. This will save us some time in porting the image to the marketplace and other datacenters. |
@revilokeb, keep an eye on it. We are changing a lot of stuff and the readme is not correct at all now, need to change that as soon as I can. But you can check the code, it's pretty straightforward |
first build with TF + Caffe, without Cuda, rough but fully automated,…
After a long wait, the official AMIs with support for Caffe, XGBoost and Tensorflow backends are available for both GPU and CPU: See https://deepdetect.com/products/ami/ for thorough documentation. |
Providing AMI is a good idea to ease deployment for some users.Related links of interest:- Deprecated Caffe AMI: https://github.com/BVLC/caffe/wiki/Ubuntu-14.04-ec2-instance- Newly contributed Caffe AMI (that includes Torch): http://blog.titocosta.com/post/110345699197/public-~ec2-ami-with-torch-and-caffe-deep-learning- Another Caffe AMI and Docker: BVLC/caffe#1092 (comment)- An AMI for deep learning, and that contains Caffe: https://www.kaggle.com/forums/f/208/getting-started/t/11505/an-aws-ami-mainly-for-deep-learningAfter a long wait, the official AMIs with support for Caffe, XGBoost and Tensorflow backends are available for both GPU and CPU:
See https://deepdetect.com/products/ami/ for thorough documentation.
The text was updated successfully, but these errors were encountered: