-
Notifications
You must be signed in to change notification settings - Fork 226
add upgrade docs, how to use, how to develop. #206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d59626b
add upgrade docs, how to use, how to develop.
davidkoski 29417f9
fix link
davidkoski 82b8417
update blurb
davidkoski ec4538d
fix link
davidkoski 3972614
add macro docs, reference for shortcut
davidkoski f9798ec
move some documentation from README to upgrade. Prep README for 3.x …
davidkoski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # ``MLXHuggingFace`` | ||
|
|
||
| Macros to assist in adapting HuggingFace Hub and Tokenizer libraries. | ||
|
|
||
| ## Overview | ||
|
|
||
| See [MLXLMCommon](MLXLMCommon) for information about how to use these macros. | ||
|
|
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # Developing mlx-swift-lm | ||
|
|
||
| Techniques for developing _in_ mlx-swift-lm. | ||
|
|
||
| ## Work on Infrastructure | ||
|
|
||
| The simplest case for working in mlx-swift-lm is working on | ||
| infrastructure, e.g. ``KVCache`` or ``ToolCallParser``. | ||
| You can simply fork mlx-swift-lm and modify the files. There are unit | ||
| tests that let you exercise the functionality and you can add | ||
| more for your specific additions. | ||
|
|
||
| The unit tests run without downloading model weights. There | ||
| are some tests that exercise the models by using random | ||
| weights and mock tokenizers, see EvalTests. This is mostly | ||
| useful for testing the generation loop itself rather than | ||
| any particular model. | ||
|
|
||
| ## Work on Models | ||
|
|
||
| If you are working on porting or modifying a model you have a few options: | ||
|
|
||
| - use `IntegrationTesting/IntegrationTesting.xcodeproj` | ||
| - use `llm-tool` from mlx-swift-examples | ||
| - use your own application | ||
|
|
||
| ### IntegrationTesting | ||
|
|
||
| `IntegrationTesting.xcodeproj` integrates with the HuggingFace | ||
| downloader and tokenizer packages directly and uses [MLXHuggingFace](MLXHuggingFace) | ||
| macros to adapt their APIs, see <doc:using> for more information. | ||
| This uses code from `IntegrationTestHelpers` | ||
| to download weights and run real models. You can easily change which models | ||
| it uses or add your own custom tests. | ||
|
|
||
| Note: these tests are _not_ run in the CI environment, but are a great way | ||
| to test the models in your own development environment. | ||
|
|
||
| ### mlx-swift-examples / custom application | ||
|
|
||
| You can also test your model by integrating it with a tool or application. | ||
| This document describes using [`llm-tool`](https://github.com/ml-explore/mlx-swift-examples/blob/main/Tools/llm-tool/README.md) from `mlx-swift-examples` | ||
| but the same technique will work with any custom code. | ||
|
|
||
| `llm-tool` is a command line tool where you can specify the prompt and the model | ||
| as arguments when you run it: | ||
|
|
||
| ``` | ||
| --model mlx-community/Mistral-7B-Instruct-v0.3-4bit | ||
| --prompt "tell me a story" | ||
| ``` | ||
|
|
||
| You will want to have mlx-swift-examples (or your own project) open in | ||
| Xcode with a local checkout of mlx-swift-lm (your fork). mlx-swift-examples | ||
| will reference a tagged version of mlx-swift-lm and you need to | ||
| switch that to reference your local version. There are two basic | ||
| methods for doing that (variations on a theme): | ||
|
|
||
| - drag the `mlx-swift-lm` _directory_ onto the top item (the mlx-swift-examples project) in the Xcode navigator and chose _reference files in place_ | ||
| - [Xcode documentation](https://developer.apple.com/documentation/xcode/editing-a-package-dependency-as-a-local-package) | ||
|
|
||
| In both cases you will get an override of the mlx-swift-lm dependency for this | ||
| project. In addition to using your local copy, you can also _edit_ mlx-swift-lm | ||
| at the same time that you use mlx-swift-examples. | ||
|
|
||
| For more details on how to configure projects in general, see <doc:using>. | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should help people who are developing new models or KVCache, etc -- it walks through the ways that you can develop and test.