-
Notifications
You must be signed in to change notification settings - Fork 216
Init exporting and loading #376
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
Conversation
Currently having issues since python does it's variable checkpoint restore, then runs init ops, which makes no sense. I can manually run restore afterwards here, but that will run it twice, and doesn't help if you load the model in python. |
I'm leaning towards not exporting our init ops at all (except maybe as bookkeeping). Any state initialized or changed within them will be handled by variable restoration anyways. And the only solution I can think of is removing |
@rnett , can you please rebase your PR since we have just upgraded to TF2.6.0 and all ops were updated as well? |
9b6ce65
to
bd12f37
Compare
tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/SavedModelBundle.java
Show resolved
Hide resolved
tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/SavedModelBundle.java
Show resolved
Hide resolved
tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/SavedModelBundle.java
Outdated
Show resolved
Hide resolved
That is strange behavior if this is what is happening, indeed. Can you please provide more details on the purpose of this PR and summarize which what is the new logic flow in the init sequence when exporting/importing a model? I'm not sure to totally understand what are the impacts of these changes, thanks |
Signed-off-by: Ryan Nett <[email protected]>
Signed-off-by: Ryan Nett <[email protected]>
Signed-off-by: Ryan Nett <[email protected]>
Signed-off-by: Ryan Nett <[email protected]>
Signed-off-by: Ryan Nett <[email protected]>
Signed-off-by: Ryan Nett <[email protected]>
Signed-off-by: Ryan Nett <[email protected]>
Signed-off-by: Ryan Nett <[email protected]>
Signed-off-by: Ryan Nett <[email protected]>
Signed-off-by: Ryan Nett <[email protected]>
Signed-off-by: Ryan Nett <[email protected]>
7afde14
to
a23775f
Compare
Signed-off-by: Ryan Nett <[email protected]>
Signed-off-by: Ryan Nett <[email protected]>
Yeah, I'm not sure why it's done that way. Nothing really changes on our end for initialization, things are just remembered better when using SavedModels. I.e. init ops will be correctly added to the init scope when loading a SavedModel, regardless of whether they were added from Python or Java (they won't be ran, since variables will already have been loaded). It also adds table init ops from some hub models as init ops, so that they are ran (see #365). |
Signed-off-by: Ryan Nett <[email protected]>
This adds proper initializer exporting to
SavedModelBundle
, and fixes #365.Won't be so big once #375 is merged.