sagemaker-python-sdk icon indicating copy to clipboard operation
sagemaker-python-sdk copied to clipboard

TypeError: ABCMeta object got multiple values for keyword argument 'code_location'

Open heiko-hotz opened this issue 3 years ago • 0 comments

Describe the bug Providing code_location in **kwargs of method create_model() in class HuggingFace throws an error message.

To reproduce

  • Run notebook https://github.com/huggingface/notebooks/blob/main/sagemaker/01_getting_started_pytorch/sagemaker-notebook.ipynb
  • After estimator.fit(), call create_model() and provide code_location (value doesn't matter) like so:
    hf_model = huggingface_estimator.create_model(
        role = sagemaker.get_execution_role(),
        code_location='test_string'
    )

Expected behavior Model should be created with the code_location that was provided

Screenshots or logs Capture2

System information A description of your system. Please provide:

  • SageMaker Python SDK version: 2.88.1
  • Framework name (eg. PyTorch) or algorithm (eg. KMeans): Huggingface
  • Framework version: 4.6
  • Python version: 3.7
  • CPU or GPU: CPU
  • Custom Docker image (Y/N): N

Additional context The error is thrown because the code_location parameter is already being populated when calling the HuggingFaceModel class, see https://github.com/aws/sagemaker-python-sdk/blob/master/src/sagemaker/huggingface/estimator.py#L316. When we pass the code_location in the **kwargs it is literally passed twice, hence the error about multiple values.

But according to the documentation we should be able to provide the code_location in the **kwargs: Keyword arguments passed to the superclass FrameworkModel and, subsequently, its superclass Model.

heiko-hotz avatar Apr 29 '22 20:04 heiko-hotz