fix: fix the bug of load LSTM model and add test#1144
Merged
Oceania2018 merged 4 commits intoSciSharp:masterfrom Jul 13, 2023
Merged
fix: fix the bug of load LSTM model and add test#1144Oceania2018 merged 4 commits intoSciSharp:masterfrom
Oceania2018 merged 4 commits intoSciSharp:masterfrom
Conversation
Collaborator
|
plz fix the ci error |
Oceania2018
approved these changes
Jul 12, 2023
Member
Failed LSTMLoad [26 s]
Error Message:
Test method Tensorflow.Keras.UnitTest.Model.ModelLoadTest.LSTMLoad threw exception:
Google.Protobuf.InvalidProtocolBufferException: Protocol message contained an invalid tag (zero).
Stack Trace:
at Google.Protobuf.ParsingPrimitives.ParseTag(ReadOnlySpan`1& buffer, ParserInternalState& state)
at Google.Protobuf.CodedInputStream.ReadTag()
at ThirdParty.Tensorflow.Python.Keras.Protobuf.SavedMetadata.MergeFrom(CodedInputStream input) in D:\a\TensorFlow.NET\TensorFlow.NET\src\TensorFlowNET.Keras\Protobuf\SavedMetadata.cs:line 158
at Google.Protobuf.MessageExtensions.MergeFrom(IMessage message, Stream input, Boolean discardUnknownFields, ExtensionRegistry registry)
at Google.Protobuf.MessageExtensions.MergeFrom(IMessage message, Stream input)
at Tensorflow.Keras.Saving.SavedModel.KerasLoadModelUtils.load(String path, Boolean compile, LoadOptions options) in D:\a\TensorFlow.NET\TensorFlow.NET\src\TensorFlowNET.Keras\Saving\SavedModel\load.cs:line 55
at Tensorflow.Keras.Saving.SavedModel.KerasLoadModelUtils.load_model(String filepath, IDictionary`2 custom_objects, Boolean compile, LoadOptions options) in D:\a\TensorFlow.NET\TensorFlow.NET\src\TensorFlowNET.Keras\Saving\SavedModel\load.cs:line 37
at Tensorflow.Keras.Models.ModelsApi.load_model(String filepath, Boolean compile, LoadOptions options) in D:\a\TensorFlow.NET\TensorFlow.NET\src\TensorFlowNET.Keras\Models\ModelsApi.cs:line 19
at Tensorflow.Keras.UnitTest.Model.ModelLoadTest.LSTMLoad() in D:\a\TensorFlow.NET\TensorFlow.NET\test\TensorFlowNET.Keras.UnitTest\Model\ModelLoadTest.cs:line 87 |
Oceania2018
approved these changes
Jul 13, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
在使用反射来根据 metadata 来恢复 layer 的时候使用的参数是
Tensorflow.Keras.ArgsDefinition.{class_name}Args,没有多余的.rnn,因此放在命名空间Tensorflow.Keras.ArgsDefinition.Rnn里的Args都读不出来,所以将所有的 layer 的 Args 都应该放在原来的Tensorflow.Keras.ArgsDefinition命名空间。同理,layer 也应该放在Tensorflow.Keras.Layers命名空间。并且所有需要恢复的 layer 的 args 里的参数都应该加上[JsonProperty] attribute,否则无法反序列化成功:TensorFlow.NET/src/TensorFlowNET.Keras/Utils/generic_utils.cs
Lines 61 to 72 in ed1a8d2