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
When creating a model, sagemaker.model.Model, if a sagemaker_session is not specified, an AttributeError: 'NoneType' object has no attribute 'create_model' is raised when invoking one of the model's functions. In the docs, also pasted below, it specifies that if the parameter is not specified, one is created. This did not work and I can confirm because when I passed in a valid sagemaker_session, the code worked fine.
sagemaker_session (sagemaker.session.Session) – A SageMaker Session object, used for SageMaker interactions (default: None). If not specified, one is created using the default AWS configuration chain.
AttributeError Traceback (most recent call last)
<ipython-input-4-b38a2118e690> in <module>()
3 target_data_s3_location='s3://pd-ds-workbench-sagemaker-stg/projects/responder_recommendations/data/output',
4 instance_type='ml.m4.xlarge',
----> 5 instance_count=1
6 )
~/SageMaker/ds-python-utils/dsutils/ml/model.py in get_predictions_s3(self, input_data_s3_location, target_data_s3_location, instance_type, instance_count, wait)
136 instance_type=instance_type,
137 output_path=target_data_s3_location,
--> 138 tags=self.aws_tags()
139 )
140
~/anaconda3/envs/python3/lib/python3.6/site-packages/sagemaker/model.py in transformer(self, instance_count, instance_type, strategy, assemble_with, output_path, output_kms_key, accept, env, max_concurrent_transforms, max_payload, tags, volume_kms_key)
520 attached to the ML compute instance (default: None).
521 """
--> 522 self._create_sagemaker_model(instance_type, tags=tags)
523 if self.enable_network_isolation():
524 env = None
~/anaconda3/envs/python3/lib/python3.6/site-packages/sagemaker/model.py in _create_sagemaker_model(self, instance_type, accelerator_type, tags)
186 self.name = self.name or utils.name_from_image(container_def["Image"])
187 enable_network_isolation = self.enable_network_isolation()
--> 188 self.sagemaker_session.create_model(
189 self.name,
190 self.role,
AttributeError: 'NoneType' object has no attribute 'create_model'
Exact command to reproduce: Call one of the sagemaker.model.Model class methods without specifying a sagemaker_session when instantiating the object (I called sagemaker.model.Model.transformer()).
The text was updated successfully, but these errors were encountered:
matthewfollegot
changed the title
SageMaker Session not getting created by default
SageMaker Session not created by default upon Model Class Instantiation
Dec 18, 2019
matthewfollegot
added a commit
to matthewfollegot/sagemaker-python-sdk
that referenced
this issue
Dec 18, 2019
System Information
Describe the problem
When creating a model,
sagemaker.model.Model
, if a sagemaker_session is not specified, anAttributeError: 'NoneType' object has no attribute 'create_model'
is raised when invoking one of the model's functions. In the docs, also pasted below, it specifies that if the parameter is not specified, one is created. This did not work and I can confirm because when I passed in a validsagemaker_session
, the code worked fine.Note: created a PR for this issue here
Minimal repro / logs
sagemaker.model.Model
class methods without specifying asagemaker_session
when instantiating the object (I calledsagemaker.model.Model.transformer()
).The text was updated successfully, but these errors were encountered: