Skip to content

SageMaker-2.128.0 Pipeline, ModelStep throws urllib AttributeError #3588

@unitsarangi

Description

@unitsarangi

The following snippet, is a modified/recommended part* of the AWS SageMaker pipeline example

step_create_model = ModelStep(
    name="AbaloneCreateModel",
    model=model.create(instance_type="ml.m5.large", accelerator_type="ml.eia1.medium")
)

When running this on a Jupyter notebook, it throws the error given below (stack).

One should be able to reproduce this error by running the above pipeline example and replacing the CreateModelStep with ModelStep as recommended. CreateModelStep is working fine. I am using the following versions in Jupyter notebook

sagemaker-2.128.0
urllib-1.26.8 (also tried urllib-1.26.14 with same error)

Here is the full error stack

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/tmp/ipykernel_31760/2450461951.py in <cell line: 25>()
     25 step_create_model = ModelStep(
     26     name="AbaloneCreateModel",
---> 27     model=model.create(instance_type="ml.m5.large", accelerator_type="ml.eia1.medium")
     28 )

~/anaconda3/envs/python3/lib/python3.10/site-packages/sagemaker/workflow/pipeline_context.py in wrapper(*args, **kwargs)
    270             return _StepArguments(retrieve_caller_name(self_instance), run_func, *args, **kwargs)
    271 
--> 272         return run_func(*args, **kwargs)
    273 
    274     return wrapper

~/anaconda3/envs/python3/lib/python3.10/site-packages/sagemaker/model.py in create(self, instance_type, accelerator_type, serverless_inference_config, tags)
    470         """
    471         # TODO: we should replace _create_sagemaker_model() with create()
--> 472         self._create_sagemaker_model(
    473             instance_type=instance_type,
    474             accelerator_type=accelerator_type,

~/anaconda3/envs/python3/lib/python3.10/site-packages/sagemaker/model.py in _create_sagemaker_model(self, instance_type, accelerator_type, tags, serverless_inference_config)
    668             # the model_data may be Pipeline variable
    669             # which may break the _base_name generation
--> 670             self._ensure_base_name_if_needed(
    671                 image_uri=container_def["Image"],
    672                 script_uri=self.source_dir,

~/anaconda3/envs/python3/lib/python3.10/site-packages/sagemaker/model.py in _ensure_base_name_if_needed(self, image_uri, script_uri, model_uri)
    696             self._base_name = (
    697                 self._base_name
--> 698                 or get_jumpstart_base_name_if_jumpstart_model(script_uri, model_uri)
    699                 or utils.base_name_from_image(image_uri, default_base_name=Model.__name__)
    700             )

~/anaconda3/envs/python3/lib/python3.10/site-packages/sagemaker/jumpstart/utils.py in get_jumpstart_base_name_if_jumpstart_model(*uris)
    244     """
    245     for uri in uris:
--> 246         if is_jumpstart_model_uri(uri):
    247             return constants.JUMPSTART_RESOURCE_BASE_NAME
    248     return None

~/anaconda3/envs/python3/lib/python3.10/site-packages/sagemaker/jumpstart/utils.py in is_jumpstart_model_uri(uri)
    170 
    171     bucket = None
--> 172     if urlparse(uri).scheme == "s3":
    173         bucket, _ = parse_s3_url(uri)
    174 

~/anaconda3/envs/python3/lib/python3.10/urllib/parse.py in urlparse(url, scheme, allow_fragments)
    390     Note that % escapes are not expanded.
    391     """
--> 392     url, scheme, _coerce_result = _coerce_args(url, scheme)
    393     splitresult = urlsplit(url, scheme, allow_fragments)
    394     scheme, netloc, url, query, fragment = splitresult

~/anaconda3/envs/python3/lib/python3.10/urllib/parse.py in _coerce_args(*args)
    126     if str_input:
    127         return args + (_noop,)
--> 128     return _decode_args(args) + (_encode_result,)
    129 
    130 # Result objects are more helpful than simple tuples

~/anaconda3/envs/python3/lib/python3.10/urllib/parse.py in _decode_args(args, encoding, errors)
    110 def _decode_args(args, encoding=_implicit_encoding,
    111                        errors=_implicit_errors):
--> 112     return tuple(x.decode(encoding, errors) if x else '' for x in args)
    113 
    114 def _coerce_args(*args):

~/anaconda3/envs/python3/lib/python3.10/urllib/parse.py in <genexpr>(.0)
    110 def _decode_args(args, encoding=_implicit_encoding,
    111                        errors=_implicit_errors):
--> 112     return tuple(x.decode(encoding, errors) if x else '' for x in args)
    113 
    114 def _coerce_args(*args):

AttributeError: 'Properties' object has no attribute 'decode'

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: pipelinesRelates to the SageMaker Pipeline Platform

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions