43 lines
1.3 KiB
Bash
43 lines
1.3 KiB
Bash
|
|
#!/bin/sh
|
|
models=$(ollama list | tail -n +2 | awk '{print $1}' | sort)
|
|
|
|
#ollama list | tail -n +2 | awk '{print $1}' | xargs -I {} sh -c 'echo "ollama list {}'
|
|
# Analyzing ollama list script
|
|
|
|
#echo "Local Models :"
|
|
#echo $models
|
|
# Define color codes
|
|
MODEL_COLOR='\033[0;34m' # Blue
|
|
PARAM_COLOR='\033[0;32m' # Green
|
|
CONTEXT_COLOR='\033[0;33m' # Yellow
|
|
QUANT_COLOR='\033[0;35m' # Red
|
|
NC='\033[0m' # No Color
|
|
|
|
# Initialize counter
|
|
counter=1
|
|
echo "Local models :"
|
|
# Loop through each model and display the required information with colors
|
|
for model in $models; do
|
|
model_info=$(ollama show "$model" | grep -E "parameters|context length|quantization")
|
|
parameters=$(echo "$model_info" | grep "parameters" | awk '{print $2}')
|
|
context_length=$(echo "$model_info" | grep "context length" | awk '{print $3}')
|
|
quantization=$(echo "$model_info" | grep "quantization" | awk '{print $2}')
|
|
|
|
# Print with counter
|
|
echo "${counter}. ${PARAM_COLOR}$model${NC}, ${CONTEXT_COLOR}$parameters${NC}, ${QUANT_COLOR}$quantization${NC}, Context: $context_length"
|
|
|
|
# Increment counter
|
|
((counter++))
|
|
done
|
|
|
|
|
|
for model in $models; do
|
|
|
|
echo "${PARAM_COLOR}Pulling model: ${CONTEXT_COLOR}$model${NC}"
|
|
|
|
ollama pull "$model"
|
|
done
|
|
echo "Updating ollama python module :"
|
|
pip3.10 install --upgrade ollama
|