之间的命令可以将LORA导出safetensors文件,这个文件可以直接倒入LM studio,但是OLLAMA 不支持,之前需要安装LLAMA.CPP来将其转化为GGUF格式,但是今天发现MLX自带转换GGUF功能
mlx_lm.fuse \
--model ../../qwen2.5-0.5B \
--adapter-path adapters \
--save-path qwen2.5-0.5B-test_1 \
--export-gguf
上面命令将导出F16 精度的GGUF文件,默认情况下,GGUF模型会被保存在 fused_model/ggml-model-f16.gguf
,但您可以通过 --gguf-path
选项来指定文件名。
只支持float16。,导出的精度只能是flaot16,不能改变精度,无需加任何参数。
#关于--help的打印信息
mlx_lm.fuse --help
Loading pretrained model
usage: mlx_lm.fuse [-h] [--model MODEL] [--save-path SAVE_PATH]
[--adapter-path ADAPTER_PATH] [--hf-path HF_PATH]
[--upload-repo UPLOAD_REPO] [--de-quantize] [--export-gguf]
[--gguf-path GGUF_PATH]
Fuse fine-tuned adapters into the base model.
options:
-h, --help show this help message and exit
--model MODEL The path to the local model directory or Hugging Face
repo.
--save-path SAVE_PATH
The path to save the fused model.
--adapter-path ADAPTER_PATH
Path to the trained adapter weights and config.
--hf-path HF_PATH Path to the original Hugging Face model. Required for
upload if --model is a local directory.
--upload-repo UPLOAD_REPO
The Hugging Face repo to upload the model to.
--de-quantize Generate a de-quantized model.
--export-gguf Export model weights in GGUF format.
--gguf-path GGUF_PATH
Path to save the exported GGUF format model weights.
Default is ggml-model-f16.gguf.
QWEN不支持MLX转GGUF,只能LLAMA.CPP
MLX转GGUF,只有:GGUF 转换支持限于 fp16 精度的 Mistral、Mixtral 和 Llama 风格的模型