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
How to compile tensorflow model with input_signature? #802
Comments
I have added the following lines:
But I got the following errro:
|
Hi @mostafafarzaneh , |
Thanks @jeffhataws |
If I do not use
The thing is I want to send/receive jpg to/from model not raw image. |
Hi @mostafafarzaneh , You can use TensorFlow Hub to convert the Neuron saved model (after tfn.trace) to one that has preprocessing (done on CPU). For example, the following script can be used to do the conversion after you adapt it to the image sizes and data type that you use:
Let us know if you have problems with this. |
Thanks @jeffhataws I can confirm that if I compile the model with But, I faced yet another issue. It works fine for molds that expect a fixed image size. However, I have another model that expects a variable size image Here is my code: Compile:
Convert:
This causes the following error in inference:
|
Hi @jeffhataws 1- signature after compile with
2- signature after converting the compiled model to custom signature:
3- But if I convert the original model to custom signature without compiling with
|
The short answer is that only fixed shape tensors are supported in Neuron at this time. The solution customers most commonly apply for this is to use shape "buckets" and then pad their inputs to match one of the compiled sizes. Another approach is to rescale images to the compiled resolution, then do a reverse scaling on the outputs. Which approach you take will depend on whether the model is sensitive to padding or scaling of the image. |
Thanks @mrnikwaws |
We have it in our roadmap and will update once its available |
Thanks @shebbur-aws |
Currently, I use
tensorflow_model_server
to serve my model for inference. Here is the export code that works fine:The model will decode the request from jpeg and encode the response to jpeg.
Now I want to compile the model to use it in Inferentia instances. However, I could not find an example or documentation to figure out how to use
tfn.trace
in this situation.The text was updated successfully, but these errors were encountered: