Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Libraries/MLXLMCommon/Registries/ModelTypeRegistry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,12 @@ public actor ModelTypeRegistry<T> {
return try creator(configuration)
}

/// Whether a creator is registered for `modelType` — i.e. this registry can
/// instantiate that architecture. Lets a caller check support without
/// attempting a (throwing, allocating) `createModel`, e.g. to decide before
/// a multi-GB download whether a Hub repo's `model_type` is runnable.
public func contains(_ modelType: String) -> Bool {
creators[modelType] != nil
}

}