Skip to content

fix: Reject unrecognized model inputs cleanly - #1311

Open
yuefdev wants to merge 1 commit into
ARM-software:mainfrom
yuefdev:fix/model-input-validation
Open

yuefdev wants to merge 1 commit into
ARM-software:mainfrom
yuefdev:fix/model-input-validation

Conversation

@yuefdev

@yuefdev yuefdev commented Sep 13, 2026

Copy link
Copy Markdown

The model-reporting CLI prints a traceback when a model file is missing or its type cannot be identified. identify_model_type() returns None, extract_model_meta() returns an empty tuple, and the caller tries to unpack four values.

Reject unrecognized model types with ArgumentParser.error() before extracting metadata. The command reports the offending path and exits nonzero without creating a partial build configuration or overwriting an existing one. Replace the nested deprecated logging call, which also emitted a stray WARNING:root:None line, with one logging.warning() call.

Validation:

  • Six subprocess regression tests pass with Python 3.10.21 and the pinned python/requirements.txt dependencies. They cover missing, empty, unrecognized binary/text and directory inputs; mixed valid/invalid inputs in both orders; preservation of an existing configuration; and successful supported-model reporting. Before the fix, the invalid-input assertions failed while the supported-model control passed.
  • Contributor hooks pass when combined locally with the Windows tooling fixes in fix: Make contributor checks work on Windows #1310. This PR contains only the three model-reporting/test files and is based independently on main.
  • Test models contain serialized TFLite metadata for inspection; no Arm inference or full C++ build was run.

This change handles files rejected by the existing model-type check. It does not add FlatBuffers structural validation for corrupt files that contain a TFLite signature.

Signed-off-by: Yusuf Efe <120668197+yuefdev@users.noreply.github.com>
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 this pull request may close these issues.

1 participant