Вам необходимо использовать «sage.session.s3_input», чтобы указать местоположение сегмента s3, где присутствуют данные обучения.
Ниже приведен пример кода:
import sagemaker as sage
from sagemaker import get_execution_role
role = get_execution_role()
sess = sage.Session()
bucket= 'dev.xxxx.sagemaker'
prefix="EstimatorName"
s3_training_file_location = "s3://{}/csv".format(bucket)
data_location_config = sage.session.s3_input(s3_data=s3_training_file_location, content_type="csv")
output_path="s3://{}/{}".format(bucket,prefix)
account = sess.boto_session.client('sts').get_caller_identity()['Account']
region = sess.boto_session.region_name
image = '{}.dkr.ecr.{}.amazonaws.com/CustomEstimator:latest'.format(account, region)
print(image)
# xxxxxx.dkr.ecr.us-heast-1.amazonaws.com/CustomEstimator:latest
tree = sage.estimator.Estimator(image,
role, 1, 'ml.c4.2xlarge',
base_job_name='CustomJobName',
code_location=output_path,
output_path=output_path,
sagemaker_session=sess)
tree.fit(data_location_config)