Skip to content

[BUG Report]: An item with the same key has already been added. Key: keras_api #1026

Open
@astronomicalphenomena

Description

@astronomicalphenomena

Description

When saving model, this error happened.
By reading Linq code, it seems like happening in TensorFlowNET.Keras.Engine.Layer.Serialize._trackable_children when concatenating model trackable with another trackable while they both have Key: keras_api

model trackable keys:
layer-0
layer-1
layer_with_weights-0
layer-2
keras_api

children keys:
non_trainable_variables
layers
variables
trainable_variables
keras_api

Reproduction Steps

load a keras pb model saved by python and save it immediately:

var model = keras.models.load_model(@"path");
model.summary();
model.save(@"path");

Known Workarounds

saveweght is fine

Configuration and Other Information

python tensorflow version: 2.10.0-GPU
TensorFlow.Redist version:2.10.0-CPU
Tensorflow.NET: 0.100.4
Tensorflow.Keras :0.10.4
.NET: 7.0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions