You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AttributeError: 'NoneType' object has no attribute '_create_model_request' #2993
if you add sagemaker_session = Session() to Model() it magically works
Expected behavior
work without specifying sagemaker_session
Screenshots or logs
request_dict = self.model.sagemaker_session._create_model_request(
AttributeError: 'NoneType' object has no attribute '_create_model_request'
System information
A description of your system. Please provide:
SageMaker Python SDK version: latest
Framework name (eg. PyTorch) or algorithm (eg. KMeans): any
Framework version: any
Python version: 3.8
CPU or GPU: any
Custom Docker image (Y/N): N
Additional context
Add any other context about the problem here.
Reacted by Chris Lemke, Niklas Palm, deeDude, kpms-ignacio-traverso, timxieICN, bernadinel, Matt M. Mo, Pierre-Arthur Claudé, kmoy1, robertfu-pepperstone and 1 more
Maybe a solution would be for the sagemaker_session to be a @property of the model, so that it can be initialized lazily by calling _init_sagemaker_session_if_does_not_exist()?
Activity
mouhannadali commentedon Aug 17, 2022
any update here?
timxieICN commentedon Mar 23, 2023
Running into the same issue. Any update?
bernadinel commentedon Mar 24, 2023
any updates ? got the same issue
davidbrochart commentedon Sep 21, 2023
There is a method to set a default session:
sagemaker-python-sdk/src/sagemaker/model.py
Line 559 in 410ab2c
But it doesn't seem to be called early enough.
Since it is accessed from another place:
sagemaker-python-sdk/src/sagemaker/workflow/steps.py
Line 609 in 410ab2c
Maybe a solution would be for the
sagemaker_sessionto be a@propertyof the model, so that it can be initialized lazily by calling_init_sagemaker_session_if_does_not_exist()?pintaoz-aws commentedon Mar 5, 2025
Fixed by #5062