Skip to content

Instantly share code, notes, and snippets.

@juliensimon
Last active June 2, 2018 08:11
Show Gist options
  • Select an option

  • Save juliensimon/003c0f78a095fd7d8049a20f549f3477 to your computer and use it in GitHub Desktop.

Select an option

Save juliensimon/003c0f78a095fd7d8049a20f549f3477 to your computer and use it in GitHub Desktop.
pytorch-params.py
# SageMaker paths
prefix = '/opt/ml/'
param_path = os.path.join(prefix, 'input/config/hyperparameters.json')
data_path = os.path.join(prefix, 'input/config/inputdataconfig.json')
# Read hyper parameters passed by SageMaker
with open(param_path, 'r') as params:
hyperParams = json.load(params)
lr = float(hyperParams.get('lr', '0.1'))
batch_size = int(hyperParams.get('batch_size', '128'))
epochs = int(hyperParams.get('epochs', '10'))
# Read input data config passed by SageMaker
with open(data_path, 'r') as params:
inputParams = json.load(params)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment