-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
AttributeError: 'Model' object has no attribute '__framework_name__' #1201
Comments
The error is here:
|
Further debugging indicates that the |
Could you provide a more detailed code sample you have been running? PyTorch and TensorFlow support implementation differ (as TF has script mode and framework mode for older versions as well as TFS for inference). For TF 2.0 serving you need to use a different Model
|
Below is a more-complete code sample. Can you provide more details on how to use the different Model you mention above? Note: I'm using the TrainingPipeline class from the step-functions SDK. Does the step-functions SDK implementation need to change to use this new model? I'm following this example... ... and adapting to TensorFlow as seen below.
|
any update? |
Sorry for the delay in response. I've reached out to the team who originally authored the notebook to see if they have any insight. Thanks for your patience! |
Note: The original notebook is working OK because it’s using PyTorch. I’m trying to use TensorFlow. |
I think the issue here is that TensforFlow returns a different model object. The TrainingPipeline is expecting to have
With some code analysis, I figure out that sagemaker-python-sdk/src/sagemaker/tensorflow/estimator.py Lines 256 to 257 in bf48fb1
@laurenyu Could you provide some insights on why does Tensorflow have two different models? |
legacy reasons - there were two different families of pre-built images for supporting TFS. |
I dig into the code a little bit, i think we need a fix in the sagemaker.workflow.airflow package. The following code can reproduce the error easily. from sagemaker.tensorflow import TensorFlow
from sagemaker.workflow.airflow import model_config, training_config
sagemaker_execution_role = 'SM_EXECUTION_ROLE'
mnist_estimator = TensorFlow(entry_point='mnist_keras_tf2.py',
source_dir='./scripts',
role=sagemaker_execution_role,
framework_version='2.0.0',
train_instance_count=1,
train_instance_type='ml.p3.2xlarge',
py_version='py3',
distributions={'parameter_server': {'enabled': True}})
train = training_config(mnist_estimator))
model = mnist_estimator.create_model()
print(model_config('ml.p3.2xlarge', model)) # <-- Will throw the exception The issue is related to the following code blocks. In Airflow package, the method requires three mandatory attributes( sagemaker-python-sdk/src/sagemaker/workflow/airflow.py Lines 517 to 525 in bf48fb1
Instead, the serving.Model has its own logic to create the model image. I believe the behavior should be consistent across all the Models. sagemaker-python-sdk/src/sagemaker/tensorflow/serving.py Lines 261 to 277 in bf48fb1
|
Any update on this? @shunjd And should this issue should be labeled a "bug" not "question"? Because of this issue, Thanks! |
thanks for looking into this, @shunjd! yes, you're right that it's a bug. we'll work on getting a fix out. |
@laurenyu @ajaykarpur Thank you for the fix, but the problem still exists. The problem is that when https://github.com/aws/sagemaker-python-sdk/blob/master/src/sagemaker/pytorch/estimator.py#L164-L169 |
Please fill out the form below.
System Information
Describe the problem
Describe the problem or feature request clearly here.
Here is the error:
We are doing this through the stepfunctions SDK with TrainingPipeline
PyTorch is OK.
pytorch/model.py
tensorflow/model.py
Minimal repro / logs
Please provide any logs and a bare minimum reproducible test case, as this will be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.
Here is the link to the successful PyTorch version: https://github.com/awslabs/amazon-sagemaker-examples/blob/346811d27ba9e1cd6a3db94a90f584b951f7aa33/step-functions-data-science-sdk/training_pipeline_pytorch_mnist/training_pipeline_pytorch_mnist.ipynb
There is no equivalent example using TensorFlow.
The text was updated successfully, but these errors were encountered: