Skip to content

Gracefully exit when pointed at a model asset instead of a model bundle directory#60

Merged
DawerG merged 1 commit into
apple:mainfrom
chpriyal:graceful-asset-exit
Jun 23, 2026
Merged

Gracefully exit when pointed at a model asset instead of a model bundle directory#60
DawerG merged 1 commit into
apple:mainfrom
chpriyal:graceful-asset-exit

Conversation

@chpriyal

Copy link
Copy Markdown
Contributor

When llm-runner / llm-benchmark were pointed at a .aimodel or .aimodelc asset instead of the parent model bundle directory, they failed with a confusing error. A compiled .aimodelc is itself a directory containing its own unrelated metadata.json, so ModelBundle parsed it, defaulted it to metadata_version "0.1", and surfaced the misleading "unsupported metadata_version '0.1'". A .aimodel path instead produced "metadata.json not found at .../model.aimodel/metadata.json".

Detect a .aimodel/.aimodelc path extension at the top of ModelBundle.init(at:), before any filesystem read, and throw a clear new BundleError.pointedAtModelAsset. Already it catches BundleError and exit non-zero, so all tools that load through ModelBundle (llm-runner, llm-benchmark, VLM dispatch) now exit gracefully.

Also align llm-benchmark's --model help text with llm-runner's ("Path to a model bundle directory").

@chpriyal chpriyal requested a review from stikves June 22, 2026 20:53
@chpriyal chpriyal force-pushed the graceful-asset-exit branch 2 times, most recently from ff53e30 to b943cad Compare June 22, 2026 22:36
…le directory

When llm-runner / llm-benchmark were pointed at a .aimodel or .aimodelc
asset instead of the parent model bundle directory, they failed with a
confusing error. A compiled .aimodelc is itself a directory containing
its own unrelated metadata.json, so ModelBundle parsed it, defaulted it
to metadata_version "0.1", and surfaced the misleading "unsupported
metadata_version '0.1'". A .aimodel path instead produced
"metadata.json not found at .../model.aimodel/metadata.json".

Detect a .aimodel/.aimodelc path extension at the top of
ModelBundle.init(at:), before any filesystem read, and throw a clear
new BundleError.pointedAtModelAsset. The CLIs already catch BundleError
and exit non-zero, so all tools that load through ModelBundle
(llm-runner, llm-benchmark, VLM dispatch) now exit gracefully.

Also align llm-benchmark's --model help text with llm-runner's
("Path to a model bundle directory").
@chpriyal chpriyal force-pushed the graceful-asset-exit branch from b943cad to f8ae6fa Compare June 22, 2026 23:09
@chpriyal chpriyal self-assigned this Jun 22, 2026
@DawerG DawerG merged commit d5804c8 into apple:main Jun 23, 2026
3 checks passed
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.

3 participants