aws / amazon-sagemaker-examples

Example 📓 Jupyter notebooks that demonstrate how to build, train, and deploy machine learning models using 🧠 Amazon SageMaker.
https://sagemaker-examples.readthedocs.io
Apache License 2.0
10.09k stars 6.76k forks source link

Sagemaker Neo #688

Open bharat-patidar opened 5 years ago

bharat-patidar commented 5 years ago

I have few questions for Sagemaker Neo: (Apologies to create an Issue for this but I couldn't get answers on aws forum for the same)

1) Can I take advantage of Sagemaker Neo if I have an externally trained tensorflow/mxnet model?

2) Sagemaker provides container image for 'image-classification' and it has released a new image with name 'image-classification-neo' for the neo compilation job. What is the difference between both of them? Do I require a new Neo compatible image for each pre built sagemaker template(container) similarly?

Any help would be appreciated

Thanks!!

ciphr commented 5 years ago
  1. Yes, you can compile a TensorFlow or MXNet model trained elsewhere using SageMaker Neo. You can deploy the compiled model in Amazon SageMaker endpoints, AWS EC2 instances, Greengrass devices, or any other machines in the cloud or at the edge that with the Neo runtime installed.

  2. The image-classification image contains the framework (MXNet), which executes the trained model. The image-classification-neo image contains the Neo runtime, which executes the (trained and) compiled model. You can run any XGBoost, TensorFlow, MXNet, or PyTorch model compiled by Neo in a container that includes the Neo runtime (see https://github.com/neo-ai/).

bharat-patidar commented 5 years ago

Hi Vin, Thank You for the response . I have some more questions : 1) I found two different functions to import externally trained tensorflow model in sagemaker for inference a) from sagemaker.tensorflow.model import TensorFlowModel b) from sagemaker.tensorflow.serving import Model when I try to use method a) I couldn't import my externally trained tf model while method b) helped me to load it in sagemaker environment but when I tried to run _compliedmodel it throws me error that this model object has no attribute compiled_model. So can you please suggest me which function can successfully help me load pretrained tensorflow model in sagemaker given that it would support compiled_model function as well https://forums.aws.amazon.com/thread.jspa?messageID=891164&#891164

2) How can I compile model from sagemaker Neo which is generated from object detection algorithm (image uri) provided by sagemaker. https://github.com/awslabs/amazon-sagemaker-examples/blob/master/introduction_to_amazon_algorithms/object_detection_pascalvoc_coco/object_detection_image_json_format.ipynb