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

Nest error on using keras.callbacks.ModelCheckpoint at multi-input(maybe output also) model #2896

Open
WondooSeo opened this issue Oct 20, 2022 · 0 comments

Comments

@WondooSeo
Copy link

WondooSeo commented Oct 20, 2022

Hi, I found some issue on multi-input model problem when I add keras.callbacks.ModelCheckpoint as callback in fit. I use tensorflow 2.6.0 and python 3.9. I don't use tf-nightly because of laptop environment(1660ti).

When I add

keras.callbacks.ModelCheckpoint(
        filepath='best_model.keras',
        monitor='val_loss',
        save_best_only=True
    )

in my callback method in model fit, it raise error below;

ValueError: The target structure is of type <class 'keras.engine.keras_tensor.KerasTensor'>
KerasTensor(type_spec=TensorSpec(shape=(None, 22), dtype=tf.float32, name='input_1'), name='input_1'...
However the input structure is a sequence (<class 'list'>) of length 0.
[]
nest cannot guarantee that it is safe to map one to the other.

But when I get rid of this option, it works!

I'm really sorry that I can't open my code since its secure. But I was really struggled with handling this error.

Roughly to say my model, there are two inputs and my pre-trained functional model, and concatenate two outputs of pre-trained functional model. Those two functional model is non-trainable(== freezed) things. And there is output with some layers.

Is there any solution about this problem?

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