First install hugging face python library:
pip install --upgrade huggingface_hub
Then login to cache your token:
huggingface-cli login
Then download your model from HF that you desire.
from huggingface_hub import snapshot_download,hf_hub_download
snapshot_download(repo_id="anakin87/gemma-2-2b-neogenesis-ita",
allow_patterns=["*.json","*.safetensors","*.model"],
local_dir="./neogenesis")
Then create a Model file in the same folder:
FROM .
TEMPLATE "<start_of_turn>user
{{ if .System }}{{ .System }} {{ end }}{{ .Prompt }}<end_of_turn>
<start_of_turn>model
{{ .Response }}<end_of_turn>
"
PARAMETER stop <start_of_turn>
PARAMETER stop <end_of_turn>
PARAMETER repeat_penalty 1
LICENSE """
Original model from: https://huggingface.co/anakin87/gemma-2-2b-neogenesis-ita
"""
Then copy the entire folder into Ollama folder (if not there alreadys):
cp -r neogenesis ./ollama/models/neogenesis
cd ./ollama/models/neogenesis
Now create the model card:
ollama create gemma-2-2b-neogenesis-ita -f Modelfile
This will take several minutes depending on the file size. Once is done then you are ready to push the model on Ollama repository: First remember to add the public key after registration. Follow this: setup You first rename the model with a full qualified name:
ollama cp gemma-2-2b-neogenesis-ita robomotic/gemma-2-2b-neogenesis-ita
ollama push robomotic/gemma-2-2b-neogenesis-ita
Then anyone should be able to do:
ollama pull robomotic/gemma-2-2b-neogenesis-ita