Skip to content

Expose ModelTypeRegistry.contains(_:) for pre-load support checks#349

Open
jfranknichols wants to merge 1 commit into
ml-explore:mainfrom
jfranknichols:expose-modeltyperegistry-contains
Open

Expose ModelTypeRegistry.contains(_:) for pre-load support checks#349
jfranknichols wants to merge 1 commit into
ml-explore:mainfrom
jfranknichols:expose-modeltyperegistry-contains

Conversation

@jfranknichols

Copy link
Copy Markdown
Contributor

ModelTypeRegistry can instantiate a model type via createModel, but there is
no way to ask whether a creator is registered for a given model_type without
attempting that throwing, allocating call. The creators dictionary is private,
so the check has to live on the type.

This adds a cheap contains(_:) so a caller can, for example, decide before a
multi-GB download whether a Hub repo's model_type is runnable by the factory.

🤖 Generated with Claude Code

Lets a caller check whether the registry can instantiate a given model_type
without attempting a throwing, allocating createModel — e.g. to decide before
a multi-GB download whether a Hub repo's architecture is runnable. The creators
dictionary is private, so this check is only possible inside the type.
(Re-applied onto Apple main; the vProj fix ml-explore#247 is already upstream.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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