- Mais recentes
- Mais votos
- Mais comentários
Hi, the problem here is that your inference model's container URI 763104351884.dkr.ecr.eu-west-3.amazonaws.com/tensorflow-training:2.8-cpu-py39
is using a training image, not an inference image for TensorFlow. Because the images are each optimized for their own function, the serving executable is not available in the training container in this case.
Usually, the framework-specific SDK classes will handle this lookup for you (for example TensorFlowModel(...)
as used in the notebook you linked, or when calling sagemaker.tensorflow.TensorFlow.deploy(...)
from the Estimator class.
I see here though that you're using the generic Model
, so guess you don't know (or don't want to commit to) the framework and version at the point the Lambda function runs?
My suggestions would be:
- Can you use the Pipelines
ModelStep
to create your model before calling the Lambda deployment function? Similarly to how your linked notebook usesCreateModelStep
. This would build your framework & version into the pipeline definition itself, but should mean that the selection of inference container image gets handled properly & automatically. - If you really need to be dynamic, I think you might need to find a way of looking up at least the framework from the training job. From my testing, you can use
estimator = sagemaker.tensorflow.TensorFlow.attach("training-job-name")
and thenmodel = estimator.create_model(...)
to correctly infer the specific inference container version from a training job, but it still relies on knowing that TensorFlow is the correct framework. I'm not aware of a framework-agnostic equivalent? So could e.g. try describing the training job, manually inferring which framework it uses from that information, and then using the relevant framework estimator class' attach() method to figure out the specifics and create your model.
Conteúdo relevante
- AWS OFICIALAtualizada há 7 meses
Hi Alex! It was my mistake to use the generic Model. After switching to sagemaker.tensorflow.model.TensorFlowModel and following your suggestion (first point) to use CreateModelStep, it worked :) Many thanks!!! I wonder, though, why in some examples the training image is used as the Model's image_uri like e.g., the one in this link: https://sagemaker.readthedocs.io/en/stable/amazon_sagemaker_model_building_pipeline.html