小编abc*_*abc的帖子

如何在 sagemaker 笔记本中打开存储在 S3 存储桶中的模型 tarfile?

我知道从 S3 存储桶将 .csv 文件加载到 sagemaker 笔记本中非常简单,但我想加载存储在 S3 存储桶中的 model.tar.gz 文件。我尝试执行以下操作

import botocore 
import sagemaker
from sagemaker import get_execution_role
from sagemaker.predictor import csv_serializer
import boto3

sm_client = boto3.client(service_name='sagemaker')
runtime_sm_client = boto3.client(service_name='sagemaker-runtime')

s3 = boto3.resource('s3')
s3_client = boto3.client('s3')

sagemaker_session = sagemaker.Session()
role = get_execution_role()

ACCOUNT_ID  = boto3.client('sts').get_caller_identity()['Account']
REGION      = boto3.Session().region_name
BUCKET      = 'sagemaker.prismade.net'
data_key    = 'DEMO_MME_ANN/multi_model_artifacts/axel.tar.gz'
loc = 's3://{}/{}'.format(BUCKET, data_key)
print(loc)
with tarfile.open(loc) as tar:
    tar.extractall(path='.')
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

--------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-215-bfdddac71b95> in <module>()
     20 loc = 's3://{}/{}'.format(BUCKET, …
Run Code Online (Sandbox Code Playgroud)

amazon-s3 amazon-web-services python-3.x amazon-sagemaker

5
推荐指数
1
解决办法
4015
查看次数