Skip to content

Instantly share code, notes, and snippets.

@Tedfulk
Created August 2, 2024 23:50
Show Gist options
  • Save Tedfulk/a3541a1ccc06a4c250e02528fa4bea5b to your computer and use it in GitHub Desktop.
Save Tedfulk/a3541a1ccc06a4c250e02528fa4bea5b to your computer and use it in GitHub Desktop.
update all the ollama models
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