Page 1 of 1

Ollama Modelfile

Posted: Sat Feb 08, 2025 5:11 pm
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

Re: Ollama Modelfile

Posted: Sat Feb 08, 2025 9:42 pm
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