Skip to content

Commit f831887

Browse files
authored
Merge pull request #1400 from CyanideByte/ollama-llama3.1-fix
Ollama llama3.1 loading fix
2 parents c00801d + 3bc6c0c commit f831887

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

interpreter/core/llm/llm.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,9 @@ def load(self):
311311
if self._is_loaded:
312312
return
313313

314+
if self.model.startswith("ollama/") and not ":" in self.model:
315+
self.model = self.model + ":latest"
316+
314317
self._is_loaded = True
315318

316319
if self.model.startswith("ollama/"):
@@ -323,7 +326,7 @@ def load(self):
323326
if response.ok:
324327
data = response.json()
325328
names = [
326-
model["name"].replace(":latest", "")
329+
model["name"]
327330
for model in data["models"]
328331
if "name" in model and model["name"]
329332
]
@@ -358,6 +361,7 @@ def load(self):
358361
self.max_tokens = int(self.context_window * 0.2)
359362

360363
# Send a ping, which will actually load the model
364+
model_name = model_name.replace(":latest", "")
361365
print(f"Loading {model_name}...\n")
362366

363367
old_max_tokens = self.max_tokens
@@ -398,6 +402,8 @@ def fixed_litellm_completions(**params):
398402
else:
399403
litellm.drop_params = True
400404

405+
params["model"] = params["model"].replace(":latest", "")
406+
401407
# Run completion
402408
attempts = 4
403409
first_error = None

interpreter/terminal_interface/local_setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def download_model(models_dir, models, interpreter):
257257
names=[name for name in names if not any(word.lower() in name.lower() for word in priority_models)]
258258
names=priority_models_found+names
259259

260-
for model in ["llama3", "phi3", "wizardlm2", "codestral"]:
260+
for model in ["llama3.1", "phi3", "mistral-nemo", "gemma2", "codestral"]:
261261
if model not in names:
262262
names.append("↓ Download " + model)
263263

0 commit comments

Comments
 (0)