keras-team / keras-hub

Pretrained model hub for Keras 3
Apache License 2.0
804 stars 243 forks source link

Task models fix #1922

Closed martin-gorner closed 1 month ago

martin-gorner commented 1 month ago

Some task models (not all) were initialized from "inputs", i.e. the flattened list of input vectors, rather than "input", which is the full input structure. This caused a mismatched between the data structure generated by the preprocessor and the one expected by the model. Since Keras PR 20170, this throws a warning when the model is applied to data coming from the preprocessor.

I suspect that this can also lead to an inversion between token_ids and padding_mask when the input structure is flattened.

This PR fixes the issues for the affected models and adds a test for task models ensuring that the structure returned by the preprocessor always matched the structure expected by the model.