Created
August 2, 2024 23:50
-
-
Save Tedfulk/a3541a1ccc06a4c250e02528fa4bea5b to your computer and use it in GitHub Desktop.
update all the ollama models
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function update_ollama_models { | |
echo "Fetching list of Ollama models..." | |
jobs=() | |
ollama list | tail -n +2 | while read -r line; do | |
model_name=$(echo "$line" | awk '{print $1}') | |
if [[ -n "$model_name" ]]; then | |
echo "Attempting to update model: $model_name" | |
ollama pull "$model_name" & | |
jobs+=("$!") | |
echo "Started update for model: $model_name" | |
else | |
echo "No model name extracted from line: $line" | |
fi | |
done | |
for job in "${jobs[@]}"; do | |
wait "$job" | |
done | |
ollama list | tail -n +2 | awk -F"\t" '{printf "%s\t%s\t%s\t%s\n", $1, $3, $4, $5}' | |
echo "Ollama models update complete." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment