mlx-examples icon indicating copy to clipboard operation
mlx-examples copied to clipboard

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

Open SOSONAGI opened this issue 1 year ago • 2 comments

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.

SOSONAGI avatar Dec 20 '23 06:12 SOSONAGI

That is definitely not expected. The adapter file should have a npz extension (our savez automatically adds this even if you don't specify it). Could you double check that the file exists with a .npz extension?

awni avatar Dec 20 '23 14:12 awni

Hi, I really appreciate your kind response.

I've got the .npz file as below after i've finished to train the fine-tune.

스크린샷 2023-12-22 오전 5 24 33

but, i got errors that i've uploaded issues two days ago.

Do i have to change something on line in lora.py or re-train that?

Thank you very much for that.

SOSONAGI avatar Dec 21 '23 20:12 SOSONAGI