mlx-swift-examples icon indicating copy to clipboard operation
mlx-swift-examples copied to clipboard

LLMEval: Model Configuration Registry Remains Empty, Preventing Dynamic Model Selection

Open 1-ashraful-islam opened this issue 5 months ago • 1 comments

I am currently working on implementing a model picker so selecting a new model does not require recompiling the app. I was trying to use https://github.com/ml-explore/mlx-swift-examples/blob/0af2efe8a04d11a7c01616e560a3bd67ac38f246/Libraries/LLM/Models.swift#L39

However, I am seeing this registry that is supposed to hold the configurations for available model always stays empty, and as such I can not use this to create a model picker. I am also noticing the bootstrap function, which is intended to populate the registry, is never called either. bootstrap function is referenced in a few places in the file. https://github.com/ml-explore/mlx-swift-examples/blob/0af2efe8a04d11a7c01616e560a3bd67ac38f246/Libraries/LLM/Models.swift#L103-L122

I'm trying to understand the original design intention behind the registry and whether using it to create a dynamic model picker in ContentView is an appropriate use case.

As someone new to Swift development, I'm unsure if I'm missing a crucial step in the implementation or if there's an issue with how the bootstrap function is supposed to be triggered. Any guidance or insights on how to correctly implement or debug this feature would be greatly appreciated.

1-ashraful-islam avatar Mar 17 '24 00:03 1-ashraful-islam

You aren't missing anything, the implementation falls slightly short. Perhaps registry should not be public (expose via a function?) or maybe it can be done with a lazy property.

Right now the only callers get to it via ModelConfiguration.mistral7B4bit (which will get the property directly) or via a call to configuration(id: ...) which will populate the registry. There wasn't a use case where somebody used the registry directly (but clearly that seems like a reasonable thing to do).

davidkoski avatar Mar 17 '24 04:03 davidkoski