2024-06-04 12:42:14 -07:00
|
|
|
#!/bin/bash
|
2024-06-07 02:32:51 -07:00
|
|
|
# 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.
|
2024-06-04 12:42:14 -07:00
|
|
|
|
2024-06-07 02:32:51 -07:00
|
|
|
modelfiles="$(ls ./modelfiles/)"
|
2024-06-04 12:42:14 -07:00
|
|
|
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
|
|
|
|
|
2024-06-07 02:32:51 -07:00
|
|
|
cd ./modelfiles
|
|
|
|
for modelfile in ./*; do
|
2024-06-04 12:42:14 -07:00
|
|
|
echo -n "Running: '"
|
|
|
|
echo "ollama create \"$(basename $modelfile)\" -f \"$modelfile\"'"
|
|
|
|
ollama create "$(basename $modelfile)" -f "$modelfile"
|
|
|
|
done
|