Commit 67c1990
committed
llama-router: add --import-dir for custom model collections
New CLI flag --import-dir <path> recursively scans local directories
and imports GGUF models as manual state (spawn on-demand only)
Features:
- Smart mmproj detection: skips mmproj files as standalone models
- Auto-associates mmproj to models in same directory
- Priority: BF16 > F16 > F32 when multiple mmproj variants exist
- All quants of same model share the same prioritized mmproj
- Idempotent: won't duplicate existing models on re-import
- Manifest-optional: works without HF manifests for local collections
Fixes:
- Robust manifest handling: no crash if manifest JSON missing
- PATH binary check: only validates paths with separators
Example directory structure:
/mnt/models/
├─ unsloth/
│ ├─ Qwen3-VL-32B-Instruct-GGUF/
│ │ ├─ Qwen3-VL-32B-Instruct-Q4_K_M.gguf ─┐
│ │ ├─ Qwen3-VL-32B-Instruct-Q5_K_M.gguf ─┼─> all use mmproj-BF16.gguf
│ │ ├─ Qwen3-VL-32B-Instruct-Q6_K.gguf ─┘
│ │ ├─ mmproj-BF16.gguf <- priority 1 (selected)
│ │ ├─ mmproj-F16.gguf <- priority 2
│ │ └─ mmproj-F32.gguf <- priority 3
│ └── DeepSeek-R1-Distill-Qwen-32B-GGUF/
│ ├─ DeepSeek-R1-Distill-Qwen-32B-Q5_K_M.gguf
│ └─ DeepSeek-R1-Distill-Qwen-32B-Q6_K.gguf
└── bartowski/
└─ Valkyrie-49B-v2-GGUF/
├─ Valkyrie-49B-v2-Q4_K_M.gguf
└─ Valkyrie-49B-v2-IQ4_NL.gguf
Usage:
llama-router --import-dir /mnt/models/
llama-router --import-dir ~/my-gguf-collection
All imported models are set to manual state (never auto-removed by rescan)1 parent dda9dc6 commit 67c1990
File tree
6 files changed
+137
-19
lines changed- tools/router
6 files changed
+137
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | | - | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | 33 | | |
47 | 34 | | |
48 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| 38 | + | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
| |||
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
61 | 70 | | |
62 | 71 | | |
63 | 72 | | |
| |||
72 | 81 | | |
73 | 82 | | |
74 | 83 | | |
| 84 | + | |
75 | 85 | | |
76 | 86 | | |
77 | 87 | | |
| |||
112 | 122 | | |
113 | 123 | | |
114 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
115 | 166 | | |
116 | 167 | | |
117 | 168 | | |
| |||
127 | 178 | | |
128 | 179 | | |
129 | 180 | | |
| 181 | + | |
| 182 | + | |
130 | 183 | | |
131 | 184 | | |
132 | 185 | | |
133 | 186 | | |
134 | 187 | | |
135 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
136 | 192 | | |
137 | 193 | | |
138 | 194 | | |
| |||
148 | 204 | | |
149 | 205 | | |
150 | 206 | | |
151 | | - | |
152 | | - | |
153 | 207 | | |
154 | 208 | | |
155 | 209 | | |
| |||
0 commit comments