mlx-examples/llms/mlx_lm
JosefAlbers 10853b57d9
Add model_config parameter to load() and load_model() (#770)
* Add `model_config` parameter to `load()` and `load_model()`

For easy editing of the loaded model configuration (e.g., for changing RoPE theta or scaling of Phi-3 model)

Example:

```python
from mlx_lm import load, generate
model, tokenizer = load("mlx-community/Phi-3-mini-4k-instruct-4bit-no-q-embed", model_config={"rope_theta":50000.0})
response = generate(model, tokenizer, prompt, max_tokens=MAX_TOKENS)
```

* Possible bug (default_loss)

* Revert "Possible bug (default_loss)"

This reverts commit 70a55ace18.

* Fix default_loss for lora

* 1. move load_model's new optional `model_config` arg to the end (fetch_from_hub()'s `model = load_model(model_path, lazy)`) 2. fix indentations (`black` hook)
2024-05-10 10:13:34 -07:00
..
examples Update lora_config.yaml (#735) 2024-04-28 10:24:34 -07:00
models Fix llama cache check (#763) 2024-05-08 08:35:54 -07:00
tuner fix lora for openelm (#773) 2024-05-10 09:51:41 -07:00
__init__.py Fix import warning (#479) 2024-02-27 08:47:56 -08:00
convert.py Create executables for generate, lora, server, merge, convert (#682) 2024-04-16 16:08:49 -07:00
fuse.py Save lora config (#636) 2024-04-02 13:52:53 -07:00
generate.py Add MLX Cache Limit setting for mlx_lm.generate and mlx_lm.server CLI (#744) 2024-05-03 12:42:48 -07:00
gguf.py fix(mlx-lm): type hints in gguf.py (#621) 2024-03-26 07:56:01 -07:00
LORA.md MiniCPM implementation (#685) 2024-04-25 15:29:28 -07:00
lora.py Fix lora for qwen moe (#743) 2024-05-02 21:55:09 -07:00
MANAGE.md Add model management functionality for local caches (#736) 2024-05-03 12:20:13 -07:00
manage.py Add model management functionality for local caches (#736) 2024-05-03 12:20:13 -07:00
MERGE.md Create executables for generate, lora, server, merge, convert (#682) 2024-04-16 16:08:49 -07:00
merge.py Create executables for generate, lora, server, merge, convert (#682) 2024-04-16 16:08:49 -07:00
py.typed Add py.typed to support PEP-561 (type-hinting) (#389) 2024-01-30 21:17:38 -08:00
README.md feat: move lora into mlx-lm (#337) 2024-01-23 08:44:37 -08:00
requirements.txt Quantize embedding / Update quantize API (#680) 2024-04-18 18:16:10 -07:00
sample_utils.py Use async eval (#670) 2024-04-11 13:18:23 -07:00
SERVER.md Validate server params & fix logit bias bug (#731) 2024-04-30 07:27:40 -07:00
server.py Add MLX Cache Limit setting for mlx_lm.generate and mlx_lm.server CLI (#744) 2024-05-03 12:42:48 -07:00
tokenizer_utils.py Kv cache (#643) 2024-05-08 08:18:13 -07:00
UPLOAD.md Mlx llm package (#301) 2024-01-12 10:25:56 -08:00
utils.py Add model_config parameter to load() and load_model() (#770) 2024-05-10 10:13:34 -07:00
version.py Kv cache (#643) 2024-05-08 08:18:13 -07:00

Generate Text with MLX and 🤗 Hugging Face

This an example of large language model text generation that can pull models from the Hugging Face Hub.

For more information on this example, see the README in the parent directory.

This package also supports fine tuning with LoRA or QLoRA. For more information see the LoRA documentation.