82 Commits

Author SHA1 Message Date
zs
747fd64ce0 Merge branch 'main' of https://github.com/ml-explore/mlx-swift-examples 2024-08-02 12:10:56 +08:00
zs
b1fbb95f17 配置 2024-08-02 12:10:49 +08:00
Awni Hannun
885e520ecd Some fixes for gemma2 (#99)
* some fixes for gemma2

* format

* fixes

* format
2024-08-01 20:06:11 -07:00
Anthony
ac6bdfccec Add Llama 3.1 (#98)
* Update Mistral 7B config

* Add Mistral NeMo

* Update for Llama 3.1

* Align LlamaConfiguration with Python implementation

* Fix model configuration names

* Refine DynamicNTKScalingRoPE

* compute base only once

---------

Co-authored-by: Awni Hannun <awni@apple.com>
2024-07-26 13:05:42 -07:00
Anthony DePasquale
c4fda0e036 Add Mistral NeMo (#97)
* Update Mistral 7B config

* Add Mistral NeMo
2024-07-25 08:01:26 -07:00
Anthony DePasquale
a2e8d7e469 Add SmolLM (#95) 2024-07-23 15:42:52 -07:00
Anthony DePasquale
2a2931ba8d Fix extra EOS tokens (#91)
* Fix extra EOS tokens

* Fix pre-commit error
2024-07-03 16:22:29 -07:00
Anthony DePasquale
0c08f3a7e4 Add Gemma 2 (#88) 2024-07-01 09:35:43 -07:00
David Koski
7957378077 pin gzip dependency (#87)
- later versions have compile issues: https://github.com/1024jp/GzipSwift/issues/65

fixes: https://github.com/ml-explore/mlx-swift-examples/issues/85
2024-06-27 13:48:11 -07:00
David Koski
61c0703c91 switch to tags where possible (#80) 2024-06-10 15:44:36 -07:00
David Koski
9d74afd119 handle partially quantized models (#76)
* handle partially quantized models

- fix for #53 #71 #69 #74
- in order to test the models
	- I added a default prompt of an appropriate form
	- while working on the model configuration also added additional stop tokens (#74)
- fixed the repetitionPenalty code (#71)
2024-05-28 16:35:11 -07:00
Anthony DePasquale
65f4968e5f Fix download progress (#78) 2024-05-28 14:05:37 -07:00
Ikko Eltociear Ashimine
546ce10c32 docs: update README.md (#58)
minor fix
2024-05-20 08:12:26 -07:00
Derek Lewis
6b224fee0c Add llama3 8B instruct model configuration and prompt (#75)
* Add model configuration for Llama 3 8B instruct model w/ prompt

* Correct typo in model configuration name
2024-05-20 08:11:32 -07:00
nathan
ff7610d522 remove the bias in the ffn module (#68) 2024-05-08 15:31:28 -07:00
David Koski
e5ea144fe3 update deps (#67) 2024-05-08 12:00:31 -07:00
Sachin Desai
4d20785b5d add support for OpenELM (#63)
* add support for OpenELM
* register model configuration for bootstrap
2024-04-30 09:14:27 -07:00
David Koski
dfd79d0542 try to fix #59 and #57 (#60) 2024-04-26 00:09:22 -07:00
Awni Hannun
b951b78eb2 phi3 (#54)
* phi3

Co-authored-by: David Koski <dkoski@apple.com>
2024-04-24 09:31:01 -07:00
David Koski
6c0b66f90a implement LoRA / QLoRA (#46)
* implement LoRA / QLoRA

- example of using MLX to fine-tune an LLM with low rank adaptation (LoRA) for a target task
- see also https://arxiv.org/abs/2106.09685
- based on https://github.com/ml-explore/mlx-examples/tree/main/lora

* add some command line flags I found useful during use
- --quiet -- don't print decorator text, just the generated text
- --prompt @/tmp/file.txt -- load prompt from file

* user can specify path to model OR model identifier in huggingface

* update mlx-swift reference

Co-authored-by: Ashraful Islam <ashraful.meche@gmail.com>
Co-authored-by: JustinMeans <46542161+JustinMeans@users.noreply.github.com>
2024-04-22 09:30:12 -07:00
Ashraful Islam
7e85eb8b88 adds a check before proceeding with generation (#51) 2024-04-12 12:46:29 -07:00
David Koski
96b94b0df6 prepare for lora branch (#47)
- remove async llm generation -- this is just doubling our work
	- and does not match the style used in the example applications
- package generation parameters into a struct
- refactor command line arguments into distinct pieces based on their use
	- this will be reusable in the lora commands
2024-04-10 10:56:18 -07:00
David Koski
cedf73421f make it _much_ easier to run command line tools from the command line (#49) 2024-04-09 12:23:42 -07:00
Anchen
c27208812d chore: add repetition_penalty example (#45) 2024-04-04 15:15:50 -07:00
Anchen
2d0fdfe3a9 chore(llm-tool): add the top_p option in the llm-tool (#41)
* chore: add top p option in llm-tool
* chore: wire up the top p with async generate
2024-04-03 07:54:54 -07:00
Ronald Mannak
b3eb428c60 Add Package.swift (#39)
* Add Package.swift for LLM and MNIST
* Make ModelType properties public
* Make ModelType method createModel public
* Add installation instructions to readme
2024-04-01 11:04:02 -07:00
Florent Morin
e48e2ce2c9 Append visionOS support to LLMEval (#43)
* Update `mlx-swift` to last revision

* Add Apple Vision Target

* Update visionOS UI
2024-03-31 20:48:46 -07:00
David Koski
0199407d93 LLMEval performance (#40)
* notes about performance and some performance improvements (don't update the display for every token)

* swift-format

* Update Applications/LLMEval/README.md

Co-authored-by: Awni Hannun <awni.hannun@gmail.com>

* Update Applications/LLMEval/README.md

Co-authored-by: Awni Hannun <awni.hannun@gmail.com>

---------

Co-authored-by: Awni Hannun <awni.hannun@gmail.com>
2024-03-28 12:00:52 -07:00
Awni Hannun
15b38cd146 Use fast (#38)
* update to latest mlx swift and use fast norms
* gpu usage -> memory usage
2024-03-27 16:37:35 -07:00
Anchen
3314e20a24 chore: add top_p sampling example (#34) 2024-03-26 12:44:13 -07:00
Anchen
63531bc5fa feat: add command r model support (#35)
* feat: add command r model support
2024-03-26 12:43:10 -07:00
Ashraful Islam
c37018d7d2 feat: adds gpu usages stat in the toolbar (#36)
* feat: adds gpu usages stat in the toolbar
2024-03-25 10:29:54 -07:00
David Koski
452b49aef0 fixed height for the progress view, produce more tokens (#33) 2024-03-19 08:56:37 -07:00
David Koski
857a10de91 make the mnist app/library targets match each other (#32)
* make the mnist app/library targets match each other
* switch mnist tool to 14.2 as well
2024-03-19 08:56:22 -07:00
Rounak
9e18eaa479 Add MNIST Digit Prediction/Inference (#22)
* Add Prediction to MNISTTrainer
2024-03-18 19:18:41 -07:00
Loc Bui
0588abec77 fix: Tokenizer dependency (#30) 2024-03-18 12:57:04 -07:00
Ashraful Islam
a7b2b54f18 LLMEval UI Improvements (#27)
* Feat: LLMEval UI Improvements

1. adds Markdown rendering in the UI
2. Adds init time and token/second stat
3. Minor UI enhancements

* feat: adds a copy to clipboard button for llm outputs

* adds scrollviewreader to sync with main

* ran pre-format to resolve formatting issues

* updates the missing dependency in project definition

* feat: switch between plain text and markdown

adds a segemented picker to switch between plain text and markdown
2024-03-18 09:15:50 -07:00
Pedro Cuenca
6c270a9d12 Remove Tokenizer wrapper (#28)
* Remove Tokenizer wrapper

Depends on https://github.com/huggingface/swift-transformers/pull/70

* Update swift-transformers revision
2024-03-18 09:07:52 -07:00
David Koski
0af2efe8a0 switch swift-tokenizers to main, remove some workarounds (#26)
* switch swift-tokenizers to main, remove some workarounds

- swift-tokenizers is getting a lot of updates and fixes, let's track main for now
- remove some workarounds that are no longer needed

- https://github.com/huggingface/swift-transformers/issues/63
2024-03-14 13:18:57 -07:00
David Koski
ac273a14ea fix float types in Phi (use float16) (#25)
- per suggestions in #23 ensure that the values that go into the cache are float16
2024-03-14 13:18:40 -07:00
David Koski
a1431e7155 scroll to bottom when text is generated (#24)
- also restore circleci
2024-03-14 13:18:28 -07:00
David Koski
0fb74cbfdc adopt MLXFast.scaledDotProductAttention (#23) 2024-03-12 14:04:43 -07:00
John Mai
a94bf79d7e feat: Support Starcoder2 (#20)
* feat: Support Starcoder2
2024-03-07 21:28:37 -08:00
Madroid Ma
e876e18605 update qwen2 chat template (#18) 2024-03-07 07:51:54 -08:00
John Mai
c4a1e1d108 fix: typo (#16) 2024-03-06 08:42:08 -08:00
David Koski
61105bf0c4 use memory limit API (#13)
* add buffer cache limit

* swift-format

* a more reasonable size

* add memory stats to command line tool, update to final api

* add note about changing models
2024-03-05 15:22:12 -08:00
David Koski
430b464c8d pick up ios build fix (#15) 2024-03-04 20:26:37 -08:00
Awni Hannun
4ed4ec69e7 LeNet on MNIST + readme update (#12)
* LeNet on MNIST + readme update

* tanh + remove device toggle

* remove device entirely
2024-03-04 14:16:20 -08:00
David Koski
dfc9f2fc01 apply swift-format 2024-03-03 18:40:49 -08:00
David Koski
0f454999a4 Merge pull request #11 from maiqingqiang/feat-qwen2
feat: Qwen2 support
2024-03-03 18:37:29 -08:00