Skip to content
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

[Question]: System.NotImplementedException in Tensorflow.Checkpoint.CheckpointPosition._queue_slot_variables #1230

Open
DenisBauer opened this issue Jan 31, 2024 · 0 comments

Comments

@DenisBauer
Copy link

Description

Apologies if this is a noob question but I am new to the project.

Setup:
I created a TF model in Python using the tf.keras.optimizers.Adam() optimizer and persist it to disk. Then I wrote a C# TensorFlow.NET program that tries to load that model.

Observation:
The call to keras.models.load_model fails with a System.NotImplementedException at the following call stack:

   at Tensorflow.Checkpoint.CheckpointPosition._queue_slot_variables(CheckpointPosition checkpoint_position, Queue`1 visit_queue)
   at Tensorflow.Checkpoint.CheckpointPosition._restore_descendants()
   at Tensorflow.Checkpoint.CheckpointPosition.restore(Trackable trackable)
   at Tensorflow.Checkpoint.TrackableSaver.restore(String save_path, CheckpointOptions options)
   at Tensorflow.Loader._restore_checkpoint()
   at Tensorflow.Loader..ctor(SavedObjectGraph object_graph_proto, SavedModel saved_model_proto, String export_dir, CheckpointOptions ckpt_options, LoadOptions save_options, IDictionary`2 filters)
   at Tensorflow.Loader.<>c__DisplayClass45_1.<load_partial>b__3(NameScope x)
   at Tensorflow.Binding.tf_with[T](T py, Action`1 action)
   at Tensorflow.Loader.load_partial(String export_dir, IDictionary`2 filters, Object tags, LoadOptions options)
   at Tensorflow.Keras.Saving.SavedModel.KerasLoadModelUtils.load(String path, Boolean compile, LoadOptions options)
   at Tensorflow.Keras.Saving.SavedModel.KerasLoadModelUtils.load_model(String filepath, IDictionary`2 custom_objects, Boolean compile, LoadOptions options)
   at Tensorflow.Keras.Models.ModelsApi.load_model(String filepath, Boolean compile, LoadOptions options)

When changing from Adam to SGD optimizer, everything works fine (but performance is bad).

I narrowed the problem down to this line in the source code:

throw new NotImplementedException();

➡️ My question: is this approach a known unsupported issue or am I doing something wrong.

Alternatives

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant