@@ -72,7 +72,7 @@ def download_model(models_dir, models, interpreter):
72
72
},
73
73
{
74
74
"name" : "Mistral-7B-Instruct" ,
75
- "file_name" : "Mistral-7B-Instruct-v0.3.Q5_K_M .llamafile" ,
75
+ "file_name" : "Mistral-7B-Instruct-v0.3.Q4_K_M .llamafile" ,
76
76
"size" : 4.40 ,
77
77
"url" : "https://huggingface.co/Mozilla/Mistral-7B-Instruct-v0.3-llamafile/resolve/main/Mistral-7B-Instruct-v0.3.Q4_K_M.llamafile?download=true" ,
78
78
},
@@ -241,19 +241,21 @@ def download_model(models_dir, models, interpreter):
241
241
["ollama" , "list" ], capture_output = True , text = True , check = True
242
242
)
243
243
lines = result .stdout .split ("\n " )
244
+
244
245
names = [
245
246
line .split ()[0 ].replace (":latest" , "" )
246
- for line in lines [ 1 :]
247
- if line .strip ()
247
+ for line in lines
248
+ if line .strip () and not line . startswith ( "failed" ) and not line . startswith ( "NAME" )
248
249
] # Extract names, trim out ":latest", skip header
249
250
250
- if "llama3" in names :
251
- names .remove ("llama3" )
252
- names = ["llama3" ] + names
253
-
254
- if "codestral" in names :
255
- names .remove ("codestral" )
256
- names = ["codestral" ] + names
251
+ # Models whose name contain one of these keywords will be moved to the front of the list
252
+ priority_models = ["llama3" ,"codestral" ]
253
+ priority_models_found = []
254
+ for word in priority_models :
255
+ models_to_move = [name for name in names if word .lower () in name .lower ()]
256
+ priority_models_found .extend (models_to_move )
257
+ names = [name for name in names if not any (word .lower () in name .lower () for word in priority_models )]
258
+ names = priority_models_found + names
257
259
258
260
for model in ["llama3" , "phi3" , "wizardlm2" , "codestral" ]:
259
261
if model not in names :
0 commit comments