-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.sh
More file actions
executable file
·92 lines (79 loc) · 2.06 KB
/
models.sh
File metadata and controls
executable file
·92 lines (79 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh
os=""
case "$(uname -s)" in
Darwin)
os="mac"
;;
Linux)
os="linux"
;;
CYGWIN*|MINGW*|MSYS*)
os="windows"
;;
*)
echo "Unsupported operating system"
exit 1
;;
esac
echo "Detected OS: $os"
if ! command -v ollama >/dev/null 2>&1; then
echo "ollama could not be found"
case "$os" in
mac)
echo "Installing ollama using Homebrew..."
if ! command -v brew >/dev/null 2>&1; then
echo "Homebrew not found. Please install Homebrew first: https://brew.sh/"
exit 1
fi
brew install ollama
;;
linux)
echo "Installing ollama using curl..."
curl -fsSL https://ollama.ai/install.sh | sh
;;
windows)
echo "Please install ollama manually by downloading it from https://ollama.ai"
exit 1
;;
esac
fi
checkAndInstall() {
model="$1"
echo "Checking for $model model..."
installed_models="$(ollama list 2>/dev/null | grep "$model" | awk '{print $1}')"
if [ -z "$installed_models" ]; then
echo "$model model not found. Installing..."
ollama pull "$model"
else
echo "$model model is already installed."
fi
}
createCustomModel() {
base_model="$1"
custom_name="$2"
context_size="$3"
echo "Creating custom model $custom_name from $base_model with context size $context_size..."
# Check if custom model already exists
if ollama list 2>/dev/null | grep -q "^$custom_name"; then
echo "$custom_name already exists."
return
fi
# Create a temporary Modelfile
modelfile=$(mktemp)
cat > "$modelfile" << EOF
FROM $base_model
PARAMETER num_ctx $context_size
EOF
# Create the custom model
ollama create "$custom_name" -f "$modelfile"
# Clean up
rm "$modelfile"
echo "$custom_name created successfully."
}
# Install base models
#checkAndInstall deepseek-coder:6.7b
checkAndInstall qwen3-coder:30b
checkAndInstall gpt-oss:20b
# Create custom models with larger context
createCustomModel qwen3-coder:30b qwen-coder-64k 65536
createCustomModel gpt-oss:20b gpt-oss-64k 65536