Skip to content
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

Add instruct tuning support to LoRA training #1211

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anupamme
Copy link

@anupamme anupamme commented Jan 20, 2025

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.

Fixes ml-explore#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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Instruct tuning for lora/finetune?
1 participant