Last active
June 2, 2018 08:11
-
-
Save juliensimon/003c0f78a095fd7d8049a20f549f3477 to your computer and use it in GitHub Desktop.
pytorch-params.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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