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

[BUG Report]: v0.150.0 breaks multi-input models fit #1211

Closed
Utanapishtim31 opened this issue Nov 7, 2023 · 1 comment · Fixed by #1212
Closed

[BUG Report]: v0.150.0 breaks multi-input models fit #1211

Utanapishtim31 opened this issue Nov 7, 2023 · 1 comment · Fixed by #1212
Assignees

Comments

@Utanapishtim31
Copy link

Description

Before TensorFlow.NET v0.150.0 in order to train a multi-input model, I used the method Model.fit(IEnumerable x, NDArray y, ...) with validation_data as a tuple (IEnumerable, NDArray). The enumeration IEnumerable of validation_data contains the several inputs of the model.

With v0.150.0, the tuple is implicitly cast to a ValidationDataPack but this cast keeps only the first NDArray of the validation_data.Item1 enumeration:

public ValidationDataPack((IEnumerable<NDArray>, NDArray) validation_data)
{
    this.val_x = validation_data.Item1.ToArray()[0]; <-- incompatible with multi-input!
    this.val_y = validation_data.Item2;
}

The call to Model.evaluate() in Model.FitInternal() then obviously fails since the validation data format does not match the model inputs anymore.

Reproduction Steps

The problem is obvious.

Known Workarounds

Maybe use the method Model.fit(IDatasetV2 dataset, ..., IDatasetV2 validation_data), but how do I create an IDatasetV2 from a tuple (IEnumerable, NDArray) ?

Configuration and Other Information

TensorFlow.NET 0.150.0
TensorFlow.Keras 0.15.0
Windows 11

@Wanglongzhi2001
Copy link
Collaborator

I'm so sorry for this bug, really thank you for this issue. You can use the use v0.110.4 for now, and I will fix it as soon as possible.

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

Successfully merging a pull request may close this issue.

2 participants