这是我第一次微调尝试。
我已成功创建并测试了我的 .npz 文件。
python3 lora.py \
--model mistralai/Mistral-7B-Instruct-v0.2 \
--max-tokens 8 \
--adapter-file /Users/sambrand/mlx-examples-main/lora/adapters.npz \
--prompt "What is the sentiment of this movie review? Respond with a sentiment score between 1 and 10, where 1 is hate and 10 is love. The movie review is enclosed in brackets. This is the movie review: [This apology for a movie is about absolutely nothing! Rachel Griffiths must have needed the money.]"
The sentiment score is: 1
现在我想将它重新融合到 Mistral 7B 中,以便我可以在本地使用它。但我的代码产生错误。
python3 -m mlx_lm.fuse \
--model mistralai/Mistral-7B-Instruct-v0.2 \
--adapter-file /Users/sambrand/mlx-examples-main/lora/adapters.npz \
退货:
/Library/Developer/CommandLineTools/usr/bin/python3: Error while finding module specification for 'mlx_lm.fuse' (ModuleNotFoundError: No module named 'mlx_lm')
我也尝试过:
python3 fuse.py \
--model mistralai/Mistral-7B-Instruct-v0.2 \
--adapter-file /Users/sambrand/mlx-examples-main/lora/adapters.npz \
但它返回:
usage: fuse.py [-h] [--model MODEL] [--save-path SAVE_PATH] [--adapter-file ADAPTER_FILE] [--hf-path HF_PATH] [--upload-name UPLOAD_NAME] [-d] fuse.py: error: unrecognized arguments: zsh: command not found: --adapter-file
我一直遵循 Andy Peatling 发布的说明,他们已经完成了这一点。
但我不得不说,我不完全确定我的机器上希望与adapters.npz 融合的模型在哪里。我不确定我是否通过了 HF 身份验证,因此不确定如何通过终端下载 HF 模型。我一直在像
ollama run mistral
这样的终端中通过Ollama下载模型,我认为我保存的模型是.ollama/models/blob中名为sha...
的大文件?
提前感谢您的帮助。
该指南可能有点过时了。要查看的 LoRA 文档位于:https://github.com/ml-explore/mlx-examples/blob/main/llms/mlx_lm/LORA.md
pip install mlx-lm
。mlx_lm.lora \
--model <path_to_model> \
--train \
--data <path_to_data> \
--iters 600
mlx_lm.fuse \
--model mistralai/Mistral-7B-v0.1 \
--hf-path mistralai/Mistral-7B-v0.1