mlx-examples/llms/tests
Anupam Mediratta 5c89d1f6a6 Add instruct tuning support to LoRA training
Fixes #484

Add support for instruct tuning with input/output pairs and alternative loss functions.

* **llms/mlx_lm/lora.py**
  - Add `CompletionsDataset` class to support input/output pairs.
  - Modify `Dataset` class to handle different dataset types.
  - Update `main` function to include new dataset type.

* **llms/mlx_lm/tuner/trainer.py**
  - Modify `default_loss` function to support alternative loss functions.
  - Add new `instruct_loss` function for instruct tuning.

* **llms/mlx_lm/LORA.md**
  - Add instructions for instruct tuning with input/output pairs.
  - Update documentation to include alternative loss functions.

* **llms/tests/test_datasets.py**
  - Add tests for `CompletionsDataset` and `create_dataset` functions.

* **llms/tests/test_trainer.py**
  - Add tests for `default_loss` and `instruct_loss` functions.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/ml-explore/mlx-examples/issues/484?shareId=XXXX-XXXX-XXXX-XXXX).
2025-01-20 11:42:13 +05:30
..
test_datasets.py Add instruct tuning support to LoRA training 2025-01-20 11:42:13 +05:30
test_datsets.py fix encoding with special tokens + chat template (#1189) 2025-01-03 10:50:59 -08:00
test_finetune.py reduction moved to CPU in case of distributed training (#1200) 2025-01-14 17:20:42 -08:00
test_generate.py Generation refactor: part 2 (#1099) 2024-11-23 11:47:06 -08:00
test_gguf.py fix(mlx-lm): type hints in gguf.py (#621) 2024-03-26 07:56:01 -07:00
test_models.py add internlm3 (#1206) 2025-01-15 14:55:41 -08:00
test_prompt_cache.py Allow prompt callback to generate_step (#1133) 2024-12-03 16:17:14 -08:00
test_sample_utils.py Fix no template prompt + top_k sampling (#1166) 2024-12-18 18:46:50 -08:00
test_server.py Prompt caching in mlx_lm.server (#1026) 2024-10-14 10:57:22 -07:00
test_tokenizers.py Fix decoding manually added tokens (#1164) 2024-12-17 09:54:29 -08:00
test_trainer.py Add instruct tuning support to LoRA training 2025-01-20 11:42:13 +05:30
test_tuner_utils.py LoRA: Extract small function (#614) 2024-06-02 06:38:42 -07:00
test_utils_load_model.py deepseek v3 model with pipeline parallelism (#1191) 2025-01-09 15:55:53 -08:00
test_utils.py Fix whipser conversion for safetensors models (#935) 2024-08-14 10:22:04 -07:00