Skip to content

mxnet_mnist.ipynb fix #1597

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

Merged
merged 2 commits into from
Oct 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions advanced_functionality/mxnet_mnist_byom/mxnet_mnist.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"## Introduction\n",
"In this notebook, we will train a neural network locally on the location from where this notebook is run using MXNet. We will then see how to create an endpoint from the trained MXNet model and deploy it on SageMaker. We will then inference from the newly created SageMaker endpoint. \n",
"\n",
"The neural network that we will use is a simple fully-connected neural network. The definition of the neural network can be found in the accompanying [mnist.py](mnist.py) file. The ``build_graph`` method contains the model defnition (shown below).\n",
"The neural network that we will use is a simple fully-connected neural network. The definition of the neural network can be found in the accompanying [mnist.py](mnist.py) file. The ``build_graph`` method contains the model definition (shown below).\n",
"\n",
"```python\n",
"def build_graph():\n",
Expand Down Expand Up @@ -98,10 +98,10 @@
"source": [
"### Training\n",
"\n",
"It is time to train the network. Since we are training the network locally, we can make use of mxnet training tools. The training method is also in the accompanying [mnist.py](mnist.py) file. The notebook assumes that this instance is a `p2.xlarge`. If running this in a non-GPU notebook instance, please adjust num_gpus=0 and num_cpu=1 The method is shown below. \n",
"It is time to train the network. Since we are training the network locally, we can make use of mxnet training tools. The training method is also in the accompanying [mnist.py](mnist.py) file. The method is as follows. \n",
"\n",
"```python \n",
"def train(data, hyperparameters= {'learning_rate': 0.11}, num_cpus=0, num_gpus =1 , **kwargs):\n",
"def train(data, hyperparameters= {'learning_rate': 0.11}, num_cpus=1, num_gpus =0 , **kwargs):\n",
" train_labels = data['train_label']\n",
" train_images = data['train_data']\n",
" test_labels = data['test_label']\n",
Expand Down Expand Up @@ -133,15 +133,13 @@
"outputs": [],
"source": [
"from mnist import train\n",
"model = train(data = data, num_cpus=0, num_gpus=1)"
"model = train(data = data, num_cpus=1, num_gpus=0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If you want to run the training on a cpu or if you are on an instance with cpus only, pass appropriate arguments. \n",
"\n",
"## Set up hosting for the model\n",
"\n",
"### Export the model from mxnet\n",
Expand Down