Skip to content

Commit 218c8bf

Browse files
committed
More robust priority model list
1 parent dee3a49 commit 218c8bf

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

interpreter/terminal_interface/local_setup.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,14 @@ def download_model(models_dir, models, interpreter):
248248
if line.strip() and not line.startswith("failed") and not line.startswith("NAME")
249249
] # Extract names, trim out ":latest", skip header
250250

251-
if "llama3" in names:
252-
names.remove("llama3")
253-
names = ["llama3"] + names
254-
255-
if "codestral" in names:
256-
names.remove("codestral")
257-
names = ["codestral"] + names
251+
# Models whose name start with one of these prefixes will be moved to the front of the list
252+
priority_models=["llama3","codestral"]
253+
priority_models_found=[]
254+
for prefix in priority_models:
255+
models_to_move=[name for name in names if name.startswith(prefix)]
256+
priority_models_found.extend(models_to_move)
257+
names=[name for name in names if not any(name.startswith(prefix) for prefix in priority_models)]
258+
names=priority_models_found+names
258259

259260
for model in ["llama3", "phi3", "wizardlm2", "codestral"]:
260261
if model not in names:

0 commit comments

Comments
 (0)