Commit Graph

19 Commits

Author SHA1 Message Date
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
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
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
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
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
John Mai
66d9202360 feat: Qwen2 support 2024-03-03 22:26:28 +08:00
David Koski
98ff923d91 use temperature 0.6 for command line examples as well (match python) 2024-03-01 23:23:32 -08:00
David Koski
2157333905 swift-format! 2024-03-01 14:47:43 -08:00
David Koski
82f6a969d4 llm improvements
- document the tokenizer used (https://github.com/huggingface/swift-transformers)
- provide a hook for tokenizer configuration, prompt augmentation
	- this isn't as rich as the python equivalents but it helps a little
2024-03-01 14:46:32 -08:00
Rudro Samanta
362f1c8ad8 Fix position of @main annotation
- Also update package versions otherwise things don't compile out of the box
  (you need the version where `callAsFunction` is marked `open`)
2024-02-27 13:02:13 -08:00
David Koski
3f02fcc1cb expose eosToken 2024-02-26 14:58:51 -08:00
David Koski
8870b0d386 add notes about building Release 2024-02-26 10:34:59 -08:00
David Koski
5a83d7d92b fix broken links, clarify documentation 2024-02-22 12:46:44 -08:00
David Koski
b6d1e14465 initial commit 2024-02-22 10:41:02 -08:00