aws / aws/amazon-sagemaker-examples

KeyError: 'SM_CHANNEL_TRAINING'",

Open
#995 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
11k
Forks
7k
Avg merge
8h 29m
Merged PRs (30d)
8

Description

Hallo, I am trying to build the training process in step function with the pytorch_extending_our_containers example. My code in Stepfunction looks like this :

```
"Train model": {
"Resource": "arn:aws:states:::sagemaker:createTrainingJob.sync",
"Parameters": {
"AlgorithmSpecification": {
"TrainingImage.$": "$.TrainingInput.DockerImage",
"TrainingInputMode": "File"
},
"OutputDataConfig": {
"S3OutputPath": "s3://stepfunctionssample-xxxx"
},
"StoppingCondition": {
"MaxRuntimeInSeconds": 86400
},
"ResourceConfig": {
"InstanceCount": 1,
"InstanceType": "ml.m4.xlarge",
"VolumeSizeInGB": 30
},
"RoleArn": "arn:aws:iam:xxxx",
"InputDataConfig": [
{
"DataSource": {
"S3DataSource": {
"S3DataDistributionType": "FullyReplicated",
"S3DataType": "S3Prefix",
"S3Uri.$": "$.TrainingInput.S3Path"
}
},
"ChannelName": "train",
"ContentType": "application/json"
}
],
"HyperParameters": {
"epoche": "1"
},
"TrainingJobName.$": "$$.Execution.Name"
},
"Type": "Task",
"Next": "Save Model"
},
```

After I execute, I am just getting error:
```
FailureReason": "AlgorithmError: ExecuteUserScriptError:\nCommand \"/usr/bin/python -m cifar10 --epoche 1\"\nTraceback (most recent call last):\n File \"/usr/lib/python3.5/runpy.py\", line 184, in _run_module_as_main\n \"__main__\", mod_spec)\n File \"/usr/lib/python3.5/runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"/opt/ml/code/cifar10.py\", line 170, in \n parser.add_argument('--data-dir', type=str, default=os.environ['SM_CHANNEL_TRAINING'])\n File \"/usr/lib/python3.5/os.py\", line 725, in __getitem__\n raise KeyError(key) from None\nKeyError: 'SM_CHANNEL_TRAINING'",
```

And the parameter I passed in look like this:
```
{
"comment": "Example for InputPath.",
"TrainingInput":{
"DockerImage": "{}/pytorch-extending-our-containers-cifar10-example",
"S3Path": "s3://sagemaker-{}/DEMO-pytorch-cifar10/cifar-10-batches-py"
}
}
```
thanks a lot!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.