Ollama Modelfile

Post Reply
User avatar
Antonio Linares
Site Admin
Posts: 42475
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 25 times
Been thanked: 62 times
Contact:

Ollama Modelfile

Post by Antonio Linares »

https://www.gpu-mart.com/blog/custom-ll ... -modelfile

ollama show llama2:latest --modelfile

ollama show llama2:latest --modelfile > myllama2.modelfile

Use any text or code editing tool,open and modify the system prompt and template in the model file to suit your preferences or requirements:

PARAMETER temperature 1
PARAMETER num_ctx 4096
SYSTEM """You are Mario from super mario bros acting as an assistant"""

ollama create myllama2 --file myllama2.modelfile

ollama list
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42475
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 25 times
Been thanked: 62 times
Contact:

Re: Ollama Modelfile

Post by Antonio Linares »

# Después del entrenamiento, fusiona el adaptador con el modelo base
model = model.merge_and_unload() # Unir LoRA al modelo base
model.save_pretrained("merged_model") # Guardar modelo fusionado
tokenizer.save_pretrained("merged_model")

# Requiere llama.cpp instalado
python3 llama.cpp/convert-hf-to-gguf.py merged_model/ \
--outtype f16 \
--outfile qwen2.5-3b-instruct-merged.gguf

Modelfile

Code: Select all | Expand

FROM ./qwen2.5-3b-instruct-merged.gguf
PARAMETER temperature 0.8
PARAMETER num_ctx 1024
ollama create my-model -f Modelfile
ollama run my-model
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply