Repository navigation
[doc] Add doc for importing SavedModel from TF Hub - #5523
Conversation
This covers the steps for using command-line tool, `iree-tf-import`. It's the first step in the full IREE compilation flow.
2d02c83 to
9dc5ab6
Compare
| First download the SavedModel and re-save it with a [serving signature](https://www.tensorflow.org/guide/saved_model#specifying_signatures_during_export). | ||
|
|
||
| !!! info | ||
| This is necessary because by default TensorFlow Hub SavedModels might not | ||
| have serving signatures, which are required for IREE compilation flow. |
There was a problem hiding this comment.
Ideally this (re-saving using python code) would just be an optional step to note in a "troubleshooting" section, not a critical part of the import flow.
There was a problem hiding this comment.
To expand on this a bit further:
For cases that most users will hit, we should strive for the tools to do the heavy lifting. If that means editing iree-tf-import or writing a separate tool to re-save with serving signatures (in this case), we should prefer doing that over adding more steps to our documentation.
For cases that are rarer, or optional (such as for certain optimizations), we can defer to a "troubleshooting" or "tuning performance" section.
There was a problem hiding this comment.
(and it's great that you spotted this and figured out a way to make it work, doc writing and going through user flows is expected to uncover areas to improve like this, thanks!)
There was a problem hiding this comment.
Agreed with your points. I've actually chatted with @silvasean and a mode to inspect possible entry points / exported names could be very useful and it could reduce the number of steps we require the user to take here. However, I'm not sure that we can go as far as to use iree-tf-import to modify the saved model. But @silvasean knows more there.
I agree with you that we should move the resaving into an optional step. I'm using MobileNet as an example here and I'd suspect it applies to other models from TF Hub, but indeed some SavedModel might already have that. So restructured a bit. Let me know what you think now.
There was a problem hiding this comment.
We could try a few more to see if there are shortcuts to take in practice, but unfortunately due to how SavedModel's work, the only really reliable way to know what you're getting is to load them in Python and save them in a controlled fashion.
SignatureDef saved models (i.e. "v1", though that's a misnomer as they are produced by both TF1 and TF2) are somewhat easier to handle. We can list the serving signatures, and if there is sufficiently good shape information in the model already then the user can just choose. For ObjectGraph saved models (i.e. "v2"), it gets complicated.
This covers the steps for using command-line tool,
iree-tf-import.It's the first step in the full IREE compilation flow.
Progress on #5453