Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notebooks in examples folders, they are getting errors for inferencing #242

Open
shahramjoon opened this issue Feb 11, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@shahramjoon
Copy link

in both get_started.ipynb and inference_and_resource_chaining.ipynb, the cells that have .invoke are failing

invoke_result = endpoint.invoke(body=serializer.serialize(test_data_no_target),
content_type='text/csv',
accept='text/csv')

in :7 │
│ │
│ 4 deserializer = CSVDeserializer() │
│ 5 serializer = CSVSerializer() │
│ 6 │
│ ❱ 7 invoke_result = endpoint.invoke(body=serializer.serialize(test_data_no_target), │
│ 8 │ │ │ │ │ │ │ │ content_type='text/csv', │
│ 9 │ │ │ │ │ │ │ │ accept='text/csv') │
│ 10 │
│ │
│ /opt/conda/lib/python3.11/site-packages/sagemaker_core/main/resources.py:136 in wrapper │
│ │
│ 133 │ │ @functools.wraps(func) │
│ 134 │ │ def wrapper(*args, **kwargs): │
│ 135 │ │ │ config = dict(arbitrary_types_allowed=True) │
│ ❱ 136 │ │ │ return validate_call(config=config)(func)(*args, **kwargs) │
│ 137 │ │ │
│ 138 │ │ return wrapper │
│ 139 │
│ │
│ /opt/conda/lib/python3.11/site-packages/pydantic/internal/validate_call.py:38 in │
│ wrapper_function │
│ │
│ 35 │ │ │
│ 36 │ │ @functools.wraps(wrapped) │
│ 37 │ │ def wrapper_function(*args, **kwargs): │
│ ❱ 38 │ │ │ return wrapper(*args, **kwargs) │
│ 39 │ │
│ 40 │ # We need to manually update this because partial object has no __name__ and `

│ 41 │ wrapper_function.name = extract_function_name(wrapped) │
│ │
│ /opt/conda/lib/python3.11/site-packages/pydantic/_internal/_validate_call.py:111 in call
│ │
│ 108 │ │ │ self.return_pydantic_validator = None │
│ 109 │ │
│ 110 │ def call(self, *args: Any, **kwargs: Any) -> Any: │
│ ❱ 111 │ │ res = self.pydantic_validator.validate_python(pydantic_core.ArgsKwargs(args, │
│ 112 │ │ if self.return_pydantic_validator: │
│ 113 │ │ │ return self.return_pydantic_validator(res) │
│ 114 │ │ else: │
│ │
│ /opt/conda/lib/python3.11/site-packages/sagemaker_core/main/resources.py:9441 in invoke │
│ │
│ 9438 │ │ response = client.invoke_endpoint(**operation_input_args) │
│ 9439 │ │ logger.debug(f"Response: {response}") │
│ 9440 │ │ │
│ ❱ 9441 │ │ transformed_response = transform(response, "InvokeEndpointOutput") │
│ 9442 │ │ return InvokeEndpointOutput(**transformed_response) │
│ 9443 │ │
│ 9444 │ @Base.add_validate_call │
│ │
│ /opt/conda/lib/python3.11/site-packages/sagemaker_core/main/code_injection/codec.py:248 in │
│ transform │
│ │
│ 245 │ │ │ _map_type_shape = SHAPE_DAG[_member_shape] │
│ 246 │ │ │ evaluated_value = _evaluate_map_type(data[_member_name], _map_type_shape) │
│ 247 │ │ else: │
│ ❱ 248 │ │ │ raise ValueError(f"Unexpected member type encountered: {_member_type}") │
│ 249 │ │ │
│ 250 │ │ result[attribute_name] = evaluated_value │
│ 251 │ │ if object_instance: │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: Unexpected member type encountered: blob

I am running notebooks inside sagemaker Jupyter

my sagemaker-core version is this

Name: sagemaker-core
Version: 1.0.21
Summary: An python package for sagemaker core functionalities
Home-page:
Author:
Author-email: AWS sagemaker-interests@amazon.com
License:
Location: /opt/conda/lib/python3.11/site-packages
Requires: boto3, importlib-metadata, jsonschema, mock, platformdirs, pydantic, PyYAML, rich
Required-by: sagemaker
Metadata-Version: 2.2
Installer: pip
Classifiers:
Development Status :: 3 - Alpha
Intended Audience :: Developers
License :: OSI Approved :: Apache Software License
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Entry-points:
Project-URLs:
Repository, https://github.com/aws/sagemaker-core.git

@shahramjoon shahramjoon added the bug Something isn't working label Feb 11, 2025
@shahramjoon
Copy link
Author

all of 5 notebook examples, they are getting the same errors . this is for llama-3-8B notebook

in :1 │
│ │
│ ❱ 1 response = endpoint.invoke( │
│ 2 │ │ body =json.dumps({ │
│ 3 │ │ "inputs": ["What is the capital of France?"], │
│ 4 │ │ "max_new_tokens": 512, │
│ │
│ /opt/conda/lib/python3.11/site-packages/sagemaker_core/main/resources.py:136 in wrapper │
│ │
│ 133 │ │ @functools.wraps(func) │
│ 134 │ │ def wrapper(*args, **kwargs): │
│ 135 │ │ │ config = dict(arbitrary_types_allowed=True) │
│ ❱ 136 │ │ │ return validate_call(config=config)(func)(*args, **kwargs) │
│ 137 │ │ │
│ 138 │ │ return wrapper │
│ 139 │
│ │
│ /opt/conda/lib/python3.11/site-packages/pydantic/internal/validate_call.py:38 in │
│ wrapper_function │
│ │
│ 35 │ │ │
│ 36 │ │ @functools.wraps(wrapped) │
│ 37 │ │ def wrapper_function(*args, **kwargs): │
│ ❱ 38 │ │ │ return wrapper(*args, **kwargs) │
│ 39 │ │
│ 40 │ # We need to manually update this because partial object has no __name__ and `

│ 41 │ wrapper_function.name = extract_function_name(wrapped) │
│ │
│ /opt/conda/lib/python3.11/site-packages/pydantic/_internal/_validate_call.py:111 in call
│ │
│ 108 │ │ │ self.return_pydantic_validator = None │
│ 109 │ │
│ 110 │ def call(self, *args: Any, **kwargs: Any) -> Any: │
│ ❱ 111 │ │ res = self.pydantic_validator.validate_python(pydantic_core.ArgsKwargs(args, │
│ 112 │ │ if self.return_pydantic_validator: │
│ 113 │ │ │ return self.return_pydantic_validator(res) │
│ 114 │ │ else: │
│ │
│ /opt/conda/lib/python3.11/site-packages/sagemaker_core/main/resources.py:9441 in invoke │
│ │
│ 9438 │ │ response = client.invoke_endpoint(**operation_input_args) │
│ 9439 │ │ logger.debug(f"Response: {response}") │
│ 9440 │ │ │
│ ❱ 9441 │ │ transformed_response = transform(response, "InvokeEndpointOutput") │
│ 9442 │ │ return InvokeEndpointOutput(**transformed_response) │
│ 9443 │ │
│ 9444 │ @Base.add_validate_call │
│ │
│ /opt/conda/lib/python3.11/site-packages/sagemaker_core/main/code_injection/codec.py:248 in │
│ transform │
│ │
│ 245 │ │ │ _map_type_shape = SHAPE_DAG[_member_shape] │
│ 246 │ │ │ evaluated_value = _evaluate_map_type(data[_member_name], _map_type_shape) │
│ 247 │ │ else: │
│ ❱ 248 │ │ │ raise ValueError(f"Unexpected member type encountered: {_member_type}") │
│ 249 │ │ │
│ 250 │ │ result[attribute_name] = evaluated_value │
│ 251 │ │ if object_instance: │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: Unexpected member type encountered: blob

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant