Okta Ihza Gifari
Okta Ihza Gifari

Reputation: 61

SyntaxError (amazon-sagemaker-object-has-no-attribute)

I'm running the code cell below, on SageMaker Notebook instance.

pd.concat([train_data['y_yes'], train_data.drop(['y_no', 'y_yes'], axis=1)], axis=1).to_csv('train.csv', index=False, header=False)
boto3.Session().resource('s3').Bucket(bucket_name).Object(os.path.join(prefix, 'train/train.csv')).upload_file('train.csv')
s3_input_train = sagemaker.s3_input(s3_data='s3://{}/{}/train'.format(bucket_name, prefix), content_type='csv')

And if I hit, the following error is appearing:

AttributeError: 'SageMaker' object has no attribute 's3_input'

Upvotes: 6

Views: 8439

Answers (2)

amsh
amsh

Reputation: 3387

As per the official github code, s3_input function was planned to be updated to TrainingInput. The documentation for the tutorial might not be updated for this change. Please try using TrainingInput function instead.

Replace the line: s3_input_train = sagemaker.s3_input(s3_data='s3://{}/{}/train'.format(bucket_name, prefix), content_type='csv')

with:

s3_input_train = sagemaker.TrainingInput(s3_data='s3://{}/{}/train'.format(bucket_name, prefix), content_type='csv')

Upvotes: 4

Maria Rebollo
Maria Rebollo

Reputation: 151

s3_input_train = sagemaker.input.TrainingInput(s3_data='s3://{}/{}/train'.format(bucket_name, prefix), content_type='csv')

did not work for me, but

s3_input_train = sagemaker.TrainingInput(s3_data='s3://{}/{}/train'.format(bucket_name, prefix), content_type='csv')

did.

Instead of input, use sagemaker.inputs.TrainingInput(parameters)

Upvotes: 15

Related Questions