Repository navigation
Add load_model, so plugins that name one model share it - #26
Merged
Merged
Conversation
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.
A plugin still names its own model, but now loads it with
load_modelfromkiku. Plugins that name the same model get the same loaded copy; before, each one loaded its own, and MLX does not share them (two loads of the 1.7B cleanup model measured 1.3 GB, then 2.6 GB).load_model(name, engine="mlx")returns aModelwith one method,prompt(system, text, examples)."mlx"is the only engine so far; a second one is a newModelsubclass and a newcase.promptmethod and their directmlx_lmimports.load_modelis optional. A plugin can still call mlx-lm, or anything else, from__init__.docs/hooks.mdhas a "Bring your own model" section.One behavior change:
terminal.pyhad a fixed 128-token reply limit and now gets the shared one, four times the request's length plus 64.Checked by loading three examples through
load_pluginswith the real model: one shared model object, and a translation came back.