HuggingFaceModel loading model data from us-east-2 (?)
I am following the tutorial at [1] to load the model at [2] for serving into amazon sage maker.my source code is as follows:# create Hugging Face Model Class
huggingface_model = HuggingFaceModel(
    transformers_version='4.26.0',
    pytorch_version='1.13.1',
    py_version='py39',
    model_data="s3://talaobucketone/model.tar.gz",  # path to your trained SageMaker model
#     model_data="https://talaobucketone.s3.us-west-2.amazonaws.com/model.tar.gz",
    role=role, 
)

# deploy model to SageMaker Inference
predictor = huggingface_model.deploy(
    initial_instance_count=1, # number of instances
    instance_type='ml.m5.xlarge' # ec2 instance type
)execution is failing forClientError: An error occurred (ValidationException) when calling the CreateModel operation: Could not access model data at s3://talaobucketone/model.tar.gz. Please ensure that the role "arn:aws:iam::637423572524:role/service-role/AmazonSageMakerServiceCatalogProductsUseRole" exists and that its trust relationship policy allows the action "sts:AssumeRole" for the service principal "sagemaker.amazonaws.com". Also ensure that the role has "s3:GetObject" permissions and that the object is located in us-east-2. If your Model uses multiple models or uncompressed models, please ensure that the role has "s3:ListBucket" permission.which makes sense, given the model.tar.gz is only available in us-west-2.Question:where do i setup the model to look for the data on us-west-2 instead of us-east-1?[1]Deploy models to Amazon SageMaker[2]naver-clova-ix/donut-base-finetuned-cord-v2 at official
2024-01-25T18:34:24Z
same here… waiting for an answer for your question…
2024-01-26T21:53:03Z
Several things may be at play here. You may need to make sure the python/notebook environment you’re calling this function has the AWS_REGION environment variable set at us-west-2 like so:AWS_DEFAULT_REGION=us-west-2.
2024-01-27T12:55:42Z
To whom it may concern, i think i found the answer.The region is specified in the Sagemaker session:sess = sagemaker.Session(default_bucket=sagemaker_session_bucket)

print(f"sagemaker role arn: {role}")
print(f"sagemaker bucket: {sess.default_bucket()}")
print(f"sagemaker session region: {sess.boto_region_name}")printssagemaker bucket: sagemaker-us-east-1-558105141721
sagemaker session region: us-east-1we can then change the session to whatever we want by doing:sess = sagemaker.Session(boto_session=boto3.session.Session(region_name='us-west-2'))

print(f"sagemaker role arn: {role}")
print(f"sagemaker bucket: {sess.default_bucket()}")
print(f"sagemaker session region: {sess.boto_region_name}")which printssagemaker bucket: sagemaker-us-west-2-637423572524
sagemaker session region: us-west-2
2024-01-28T00:56:11Z
This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.