Skip to content

MoonshineAudioToText LiteRT export fails with data type mismatch for encoder_padding_mask #2493

@pctablet505

Description

@pctablet505

Description

The test_litert_export test for MoonshineAudioToText is currently failing due to a data type mismatch in the LiteRT model inputs.

Steps to Reproduce

  1. Run the test: pytest keras_hub/src/models/moonshine/moonshine_audio_to_text_test.py::MoonshineAudioToTextTest::test_litert_export --run_large
  2. The test attempts to export the model to LiteRT format and run inference
  3. The test fails when setting tensor inputs to the LiteRT interpreter

Expected Behavior

The test should pass, successfully exporting the MoonshineAudioToText model to LiteRT and running inference without errors.

Actual Behavior

The test fails with the following error:

ValueError: Cannot set tensor: Got value of type INT32 but expected type BOOL for input 2, name: serving_default_encoder_padding_mask:0

This indicates that the encoder_padding_mask input is expected to be of type BOOL (boolean) in the LiteRT model, but the test is providing it as INT32 (integer).

Environment

  • Python 3.12.10
  • TensorFlow/Keras (version from pyproject.toml: keras>=3.13)
  • pytest-9.0.0

Additional Context

  • The model signature shows dtype=tf.bool for encoder_padding_mask
  • The test data is likely using integer values (0/1) instead of boolean values (True/False)
  • This is blocking LiteRT export functionality for MoonshineAudioToText models
  • The test is currently marked as skipped with @pytest.mark.skip(reason="TODO: Bug with MoonshineAudioToText liteRT export")

Possible Fix

The issue likely requires updating the test input data to use boolean values for encoder_padding_mask, or adjusting the model export process to handle integer padding masks correctly.

Metadata

Metadata

Labels

type:BugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions