SIGN IN SIGN UP

Example 📓 Jupyter notebooks that demonstrate how to build, train, and deploy machine learning models using 🧠 Amazon SageMaker.

0 0 0 Jupyter Notebook
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
from __future__ import print_function
import argparse
import gzip
import json
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
import logging
import os
import traceback
import numpy as np
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Conv2D, Dense, Flatten
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
logging.basicConfig(level=logging.DEBUG)
# Define the model object
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
class SmallConv(Model):
def __init__(self):
super(SmallConv, self).__init__()
self.conv1 = Conv2D(32, 3, activation="relu")
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
self.flatten = Flatten()
self.d1 = Dense(128, activation="relu")
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
self.d2 = Dense(10)
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
def call(self, x):
x = self.conv1(x)
x = self.flatten(x)
x = self.d1(x)
return self.d2(x)
# Decode and preprocess data
def convert_to_numpy(data_dir, images_file, labels_file):
"""Byte string to numpy arrays"""
with gzip.open(os.path.join(data_dir, images_file), "rb") as f:
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
images = np.frombuffer(f.read(), np.uint8, offset=16).reshape(-1, 28, 28)
with gzip.open(os.path.join(data_dir, labels_file), "rb") as f:
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
labels = np.frombuffer(f.read(), np.uint8, offset=8)
return (images, labels)
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
def mnist_to_numpy(data_dir, train):
"""Load raw MNIST data into numpy array
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
Args:
data_dir (str): directory of MNIST raw data.
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
This argument can be accessed via SM_CHANNEL_TRAINING
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
train (bool): use training data
Returns:
tuple of images and labels as numpy array
"""
if train:
images_file = "train-images-idx3-ubyte.gz"
labels_file = "train-labels-idx1-ubyte.gz"
else:
images_file = "t10k-images-idx3-ubyte.gz"
labels_file = "t10k-labels-idx1-ubyte.gz"
return convert_to_numpy(data_dir, images_file, labels_file)
def normalize(x, axis):
eps = np.finfo(float).eps
mean = np.mean(x, axis=axis, keepdims=True)
# avoid division by zero
std = np.std(x, axis=axis, keepdims=True) + eps
return (x - mean) / std
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
# Training logic
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
def train(args):
# create data loader from the train / test channels
x_train, y_train = mnist_to_numpy(data_dir=args.train, train=True)
x_test, y_test = mnist_to_numpy(data_dir=args.test, train=False)
x_train, x_test = x_train.astype(np.float32), x_test.astype(np.float32)
# normalize the inputs to mean 0 and std 1
x_train, x_test = normalize(x_train, (1, 2)), normalize(x_test, (1, 2))
# expand channel axis
# tf uses depth minor convention
x_train, x_test = np.expand_dims(x_train, axis=3), np.expand_dims(x_test, axis=3)
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
# normalize the data to mean 0 and std 1
train_loader = (
tf.data.Dataset.from_tensor_slices((x_train, y_train))
.shuffle(len(x_train))
.batch(args.batch_size)
)
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
test_loader = tf.data.Dataset.from_tensor_slices((x_test, y_test)).batch(args.batch_size)
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
model = SmallConv()
model.compile()
loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)
optimizer = tf.keras.optimizers.Adam(
learning_rate=args.learning_rate, beta_1=args.beta_1, beta_2=args.beta_2
)
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
train_loss = tf.keras.metrics.Mean(name="train_loss")
train_accuracy = tf.keras.metrics.SparseCategoricalAccuracy(name="train_accuracy")
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
test_loss = tf.keras.metrics.Mean(name="test_loss")
test_accuracy = tf.keras.metrics.SparseCategoricalAccuracy(name="test_accuracy")
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
@tf.function
def train_step(images, labels):
with tf.GradientTape() as tape:
predictions = model(images, training=True)
loss = loss_fn(labels, predictions)
grad = tape.gradient(loss, model.trainable_variables)
optimizer.apply_gradients(zip(grad, model.trainable_variables))
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
train_loss(loss)
train_accuracy(labels, predictions)
return
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
@tf.function
def test_step(images, labels):
predictions = model(images, training=False)
t_loss = loss_fn(labels, predictions)
test_loss(t_loss)
test_accuracy(labels, predictions)
return
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
print("Training starts ...")
for epoch in range(args.epochs):
train_loss.reset_states()
train_accuracy.reset_states()
test_loss.reset_states()
test_accuracy.reset_states()
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
for batch, (images, labels) in enumerate(train_loader):
train_step(images, labels)
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
for images, labels in test_loader:
test_step(images, labels)
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
print(
f"Epoch {epoch + 1}, "
f"Loss: {train_loss.result()}, "
f"Accuracy: {train_accuracy.result() * 100}, "
f"Test Loss: {test_loss.result()}, "
f"Test Accuracy: {test_accuracy.result() * 100}"
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
)
# Save the model
# A version number is needed for the serving container
# to load the model
version = "00000000"
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
ckpt_dir = os.path.join(args.model_dir, version)
if not os.path.exists(ckpt_dir):
os.makedirs(ckpt_dir)
model.save(ckpt_dir)
return
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--batch-size", type=int, default=32)
parser.add_argument("--epochs", type=int, default=1)
parser.add_argument("--learning-rate", type=float, default=1e-3)
parser.add_argument("--beta_1", type=float, default=0.9)
parser.add_argument("--beta_2", type=float, default=0.999)
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
# Environment variables given by the training image
parser.add_argument("--model-dir", type=str, default=os.environ["SM_MODEL_DIR"])
parser.add_argument("--train", type=str, default=os.environ["SM_CHANNEL_TRAINING"])
parser.add_argument("--test", type=str, default=os.environ["SM_CHANNEL_TESTING"])
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
parser.add_argument("--current-host", type=str, default=os.environ["SM_CURRENT_HOST"])
parser.add_argument("--hosts", type=list, default=json.loads(os.environ["SM_HOSTS"]))
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
return parser.parse_args()
if __name__ == "__main__":
MNIST offline mode with MXNet/PyTorch/TensorFlow (#1787) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * Website preview (#1764) * mnist train and test notebooks tested on local mode * added config.json for global config * training notebook requires user to be in the same region as the public s3 bucket * default to non-local mode * cleared output / added sym link to global config.json * minor fix * added swp file to gitignore; * added updated mxnet examples * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * removed zombie cells / changed public model addr * cleared outputs * default to non-local mode * default to non-local mode * removed downloaded model * default to nonlocal mode * small bug fix * Pytorch vpc (#1780) * deleted training notebook * train / deployment notebook tested in local mode * default to non-local mode * added utils * changed rst * removed a trained model * Website preview (#1785) * Notebook cleaned and data on S3 - XGBoost (#1713) * Notebook cleaned and data on S3 * Cleared all cell outputs * formatting a cell * PR comments addressed * PR comments addressed * Instance type updated * Bucket changed to prod regions bucket and citation added * Deleted install instructions * Cleaned up Linear Learner notebook (#1709) * Cleaned up Linear Learner notebook * directory name changed on S3 * PR comments addressed * Updated instance type and kernel * Bucket changed to prod bucket and citation added * Changed parameter name as in SageMaker v2 * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> * Update introduction_to_amazon_algorithms/linear_learner_abalone/Linear_Learner_Regression_csv_format.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Image classification notebook fix + data source on S3 (#1700) * Fixing notebooks * Cleared all outputs * PR comments addressed and code cleaned * Typo fix * Added kernel type in description * Fixed instance type to studio * Added instance type * Data bucket changed to prod bucket * Download links added * estimator parameter changed to be compatible with SageMaker v2 * Update introduction_to_amazon_algorithms/imageclassification_caltech/Image-classification-transfer-learning-highlevel.ipynb Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Aaron Markham <markhama@amazon.com> * Small fix, notebook formatting, data on S3 - PCA (#1715) * Small fix and notebook formatting * Variable name changed * Updated instance type and kernel * Bucket changed to prod bucket * Changed parameter name in Estimator as in SageMaker v2 * Added missing import Co-authored-by: Aaron Markham <markhama@amazon.com> * website: add getting started videos; rename featured examples to studio (#1758) * add getting started videos; rename featured examples to studio * vidoes for getting started; combine to same page * refactor byo algo with pipe mode to be python3 and sdk v2 (#1690) * Docs: Deleting working_with_redshift_data.ipynb New notebook will cover this topic in more depth. Deleting to remove duplication. https://github.com/aws/amazon-sagemaker-examples/issues/1447 * add GT video, fix links, update copyright notice (#1763) * train entry point tested * train notebook ready * train / inference tested * inference.py not needed * default to non-local mode * default to non-local mode * removed downloaded model * removed a trained model Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com> * add a line break * editorial fix par style guide * removed swp file * fix json * fixed typos * bug fix * better way to upload data * deleted empty cell * tensorflow / pytorch tested * removed mxnet for more testing * cleared output * removed mxnet from rst * minor fixes Co-authored-by: vivekmadan2 <53404938+vivekmadan2@users.noreply.github.com> Co-authored-by: Aaron Markham <markhama@amazon.com> Co-authored-by: Talia <31782251+TEChopra1000@users.noreply.github.com>
2020-11-24 00:33:47 -08:00
args = parse_args()
train(args)