amazon-sagemaker-examples icon indicating copy to clipboard operation
amazon-sagemaker-examples copied to clipboard

How is the entry point to the code specified in bring your own code?

Open judytraj007 opened this issue 8 years ago • 3 comments

I'm trying out the sample notebooks, currently in the mxnet mnist example which demonstrates bringing your own code. The entry point parameter passed in when instantiating an estimator instance, only mentions the source file (mnist.py) and not a method name or any other point inside the source file. So how does sagemaker figure out which method to send the training data to?

judytraj007 avatar Feb 28 '18 05:02 judytraj007

You should have a executable program name as "train". Sagemaker will search it by PATH.

ThisIsRick avatar Feb 28 '18 20:02 ThisIsRick

Thanks @Katniss394 for your question, and thanks @ThisIsRick for jumping in and helping answer!

As a bit more background... For the bring-your-own-algorithm use case, yes, SageMaker will look to run an executable program named "train" for training and "serve" for hosting. This example provides more detail on that. Or, alternatively, you can specify any ENTRYPOINT in your Dockerfile which has train() and serve() functions defined within. Then you can parse the command line options for "train" or "serve" to execute the right function. An example for that is here.

For the MXNet examples, we've provided the container for you. In this case, MXNet expects the source file that you pass to the MXNet estimator to have a "train()" function defined. This is the function it will automatically run when training begins. Note, your train() function can other functions or classes by including them in the same source file. More documentation on using the pre-built MXNet containers can be found here.

Thanks!

djarpin avatar Feb 28 '18 22:02 djarpin

Thank you guys!

judytraj007 avatar Mar 01 '18 05:03 judytraj007