helix icon indicating copy to clipboard operation
helix copied to clipboard

Convert axolotl loras to ollama adapter

Open rusenask opened this issue 11 months ago • 2 comments

  1. https://github.com/ggerganov/llama.cpp/blob/master/convert-lora-to-ggml.py - this should run together with adapter_config.json, adapter_model.bin and config.json. It will spit out ggml-adapter-model.bin
  2. Ollama can then load it like this with a custom model file:
FROM mistral:7b-instruct-v0.2-fp16

ADAPTER ./data/ggml-adapter-model.bin

TEMPLATE """[INST] {{ .System }} {{ .Prompt }} [/INST]"""
PARAMETER stop "[INST]"
PARAMETER stop "[/INST]"

ollama create doctors-model -f Modelfile

  1. Run the new model

rusenask avatar Mar 02 '24 21:03 rusenask

Technically this should be mistral:7b-instruct-v0.1-fp16 I think, because in Helix (with axolotl) the LoRA is finetuned on Mistral-7B v0.1, not v0.2.

lukemarsden avatar Mar 14 '24 07:03 lukemarsden

mistral:7b-instruct-v0.1-fp16 unfortunately doesn't exist anymore, mistral:7b-instruct-v0.2-fp16 works fine.

Hebbar-10 avatar Mar 20 '24 18:03 Hebbar-10