ml-explore / ml-explore/mlx-examples

After finished fine-tune training.. Invalid header in file issue..!

Open
#150 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi,

Many thanks for share this wonderful works!

I've trained mistral-7b with lora.py from the instruction and i got a adapters.npz.

I was trying to test this adapter with below commands and issues were raised.

 python lora.py --model /users/soonde17/anaconda3/envs/mlx/mlx/mlx-examples/mlx-examples/mistral-7B-v0.1 --adapter-file /users/soonde17/anaconda3/envs/mlx/mlx/mlx-examples/mlx-examples/lora/adapter_file --test

messages

Traceback (most recent call last):
  File "/Users/soonde17/anaconda3/envs/mlx/mlx/mlx-examples/mlx-examples/lora/lora.py", line 385, in <module>
    model.load_weights(args.adapter_file)
  File "/Users/soonde17/anaconda3/envs/mlx/lib/python3.10/site-packages/mlx/nn/layers/base.py", line 94, in load_weights
    self.update(tree_unflatten(list(mx.load(file).items())))
RuntimeError: [load] Invalid header in file /users/soonde17/anaconda3/envs/mlx/mlx/mlx-examples/mlx-examples/lora/adapter_file

Do i have to fix something when i fine-tune the model with lora? or retry with increase the number of iters?
(I've trained 300 inters for that)

Please help to figure this out..!

Thank you.

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 lora.py, especially the adapter loading path around the reported traceback, and compare the generated adapters.npz with the adapter_file path passed to --adapter-file. Reproduce the --test command and determine what causes the invalid header; done means the trained adapter loads successfully without that error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.