Description
Description
I'm trying to run a model I trained in Python on TensorFlow.NET. I have the weights in HDF5 format and the model replicated in TensorFlow.NET, but when I use model.load_weights(path.h5)
it fails to load the weights because it can't find the weights by name.
I did some debugging and found out that it expects dollar signs in the path for some reason, which are normally not there in the weight names.
This code seems to be recently added by #1137. The code looks awful, so please revert that change.
Reproduction Steps
In Python with TensorFlow, export some model weights using model.save_weights('my_checkpoint.h5')
Then in C# with TensorFlow.NET, load the weights using model.load_weights("my_checkpoint.h5");
Known Workarounds
Exporting weights using TensorFlow.NET inserts the dollar signs so loading works in that case.
It might be possible to workaround if you manually replace all weight names in the saved weights file.
Configuration and Other Information
- TensorFlow.NET 0.110.2
- TensorFlow.Keras 0.11.2
- .NET 6
- Windows 10