ml-explore / ml-explore/mlx-examples

Need more documentation on using a custom dataset for fine-tuning with LoRA

Open
#199 20 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation question
Dominant language
Python
Stars
9k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

The Custom Data section of the LoRa readme has helpful information about how to specify a subdirectory where train.jsonl, valid.jsonl, and test.json files are expected and the dataset in data/ has json entries of the following form:

{"text": "table: 1-1000181-1\ncolumns: State/territory, Text/background colour, Format, Current slogan, Current series, Notes\nQ: Tell me what the notes are for South Australia \nA: SELECT Notes FROM 1-1000181-1 WHERE Current slogan = 'SOUTH AUSTRALIA'"}

Looking at lora.py, I can see how to specify the JSON key (which defaults to text) but it is not clear if the instruction prompt for the custom data we provide must be in that format. Can we use a custom dataset with the Mistral Model (for example) and use the Mistral Prompt to LoRa train it?:

{"text": "<s>[INST] .. instruction .. [/INST] .. response .. </s>'"}

Or are there assumptions in lora.py that would break if we don't use the format below (from the data/ subdirectory)?

{"text": ".. context ..  \nQ: .. instruction .. \nA: .. output ..'"}

Looking at lora.py and the loss function in particular, it is unclear if we must stick with the prompt format in the example, if the training method is supervised or unsupervised, etc.

If this module was intended to be used for general purposes, some additional documentation regarding these questions would greatly help in using it (or extending it) for LoRA training on various models, prompt formats, and datasets (training on just completions - continued pretraining - for example)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the README's Custom Data section, lora.py, its loss function, and the examples under data/. Determine whether the documented JSON and prompt format are required, whether Mistral-style prompts and completion-only training are supported, and what training objective is used. Done means the README clearly documents supported dataset formats, prompt assumptions, and training behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation, machine-learning
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.