Expose ModelTypeRegistry.contains(_:) for pre-load support checks#349
Open
jfranknichols wants to merge 1 commit into
Open
Expose ModelTypeRegistry.contains(_:) for pre-load support checks#349jfranknichols wants to merge 1 commit into
jfranknichols wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ModelTypeRegistrycan instantiate a model type viacreateModel, but there isno way to ask whether a creator is registered for a given
model_typewithoutattempting that throwing, allocating call. The
creatorsdictionary is private,so the check has to live on the type.
This adds a cheap
contains(_:)so a caller can, for example, decide before amulti-GB download whether a Hub repo's
model_typeis runnable by the factory.🤖 Generated with Claude Code