谷歌有 SageMaker Studio 的答案,但我对 SageMaker Studio LAB 的答案不知所措......
我在 XGBoost 上阅读以下内容 - 我在 SM Studio LAB 的正确位置吗?
https://docs.aws.amazon.com/sagemaker/latest/dg/xgboost.html
与阅读上面的文档相比,我在 LAB 中使用 XGBoost 有没有更好的方法?
在 SageMaker Studio 中,我将执行以下操作来获取 XGBoost 算法的 ECR 容器:
from sagemaker import image_uris
container = image_uris.retrieve('xgboost', boto3.Session().region_name, '1')
我使用 github 示例使其更进一步:
https://github.com/aws/studio-lab-examples/blob/main/connect-to-aws/Access_AWS_from_Studio_Lab.ipynb
这有效:
from sagemaker import image_uris
from sagemaker.xgboost import XGBoost
# Create a training job name
job_name = 'ufo-xgboost-job-{}'.format(datetime.now().strftime("%Y%m%d%H%M%S"))
print('Here is the job name {}'.format(job_name))
import sagemaker
import boto3
from sagemaker import image_uris
from sagemaker.session import Session
from sagemaker.inputs import TrainingInput
但这给我带来了麻烦:
sess = sagemaker.Session()
xgb = sagemaker.estimator.Estimator(container,
role,
instance_count=1,
instance_type='ml.m4.xlarge',
output_path='model.tar.gz',
sagemaker_session=sess)
xgb.set_hyperparameters(objective='multi:softmax',
num_class=3,
num_round=100)
data_channels = {
'train': s3_input_train,
'validation': s3_input_validation
}
xgb.fit(data_channels, job_name=job_name)
出现以下错误:
ParsingError Traceback (most recent call last)
~/.conda/envs/default/lib/python3.9/site-packages/botocore/configloader.py in raw_config_parse(config_filename, parse_subsections)
148 try:
--> 149 cp.read([path])
150 except (six.moves.configparser.Error, UnicodeDecodeError):
~/.conda/envs/default/lib/python3.9/configparser.py in read(self, filenames, encoding)
696 with open(filename, encoding=encoding) as fp:
--> 697 self._read(fp, filename)
698 except OSError:
~/.conda/envs/default/lib/python3.9/configparser.py in _read(self, fp, fpname)
1115 if e:
-> 1116 raise e
1117
ParsingError: Source contains parsing errors: '/home/studio-lab-user/.aws/config'
[line 5]: 'from sagemaker import image_uris\n'
[line 6]: 'import boto3\n'
During handling of the above exception, another exception occurred:
底部截断错误:
ConfigParseError: Unable to parse config file: /home/studio-lab-user/.aws/config