Skip to content

fix: import DIR_PARAM_NAME and SAGEMAKER_OUTPUT_LOCATION directly in local/image.py#5824

Open
egorkosaretsky wants to merge 1 commit intoaws:masterfrom
egorkosaretsky:fix/local-mode-serve-model-builder-import
Open

fix: import DIR_PARAM_NAME and SAGEMAKER_OUTPUT_LOCATION directly in local/image.py#5824
egorkosaretsky wants to merge 1 commit intoaws:masterfrom
egorkosaretsky:fix/local-mode-serve-model-builder-import

Conversation

@egorkosaretsky
Copy link
Copy Markdown

Problem

local/image.py referenced sagemaker.serve.model_builder.DIR_PARAM_NAME and sagemaker.serve.model_builder.SAGEMAKER_OUTPUT_LOCATION via lazy attribute access on the top-level sagemaker module. This relies on sagemaker.serve.model_builder having been imported previously, which is not guaranteed. When using local mode without a prior import of sagemaker.serve.model_builder, this raises:

AttributeError: module 'sagemaker' has no attribute 'serve'

This affects any user of SageMaker local mode in v3 and is the root cause of the issue reported in #5371.

Fix

Import DIR_PARAM_NAME and SAGEMAKER_OUTPUT_LOCATION explicitly at the top of image.py instead of accessing them via the lazy module attribute chain.

Test

Existing local mode unit tests cover the affected code paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant