Jafner.net/projects/local-ai/ollama/sync-modelfiles
Joey Hafner 6086222503
Reorganize root level of repo.
- Move homelab, Jafner.dev (now called blog) to root.
- Rename "archived projects" -> "archive"
- Rename "active projects" -> "projects"
- Rename "jafner-homebrew" -> "5ehomebrew"
- Rename "docker-llm-amd" -> "local-ai"
2024-07-16 12:17:55 -07:00

23 lines
764 B
Bash
Executable File

#!/bin/bash
# THIS SCRIPT DOES NOT WORK RIGHT NOW
# The script is fine, it just needs the modelfiles to be written with reference
# to the models folder relative to the host system, rather than inside the
# container. We're using ./modelfiles/.loadmodels.sh instead right now.
modelfiles="$(ls ./modelfiles/)"
models="$(ollama list | tr -s ' ' | cut -f 1 | tail -n +2)"
for model in $(echo "$models"); do
if ! [[ $modelfiles == *"$model"* ]]; then
echo -n "Running: '"
echo "ollama rm \"$model\"'"
ollama rm "$model"
fi
done
cd ./modelfiles
for modelfile in ./*; do
echo -n "Running: '"
echo "ollama create \"$(basename $modelfile)\" -f \"$modelfile\"'"
ollama create "$(basename $modelfile)" -f "$modelfile"
done