Skip to content

Commit

Permalink
Merge pull request #1400 from CyanideByte/ollama-llama3.1-fix
Browse files Browse the repository at this point in the history
Ollama llama3.1 loading fix
  • Loading branch information
KillianLucas authored Aug 20, 2024
2 parents c00801d + 3bc6c0c commit f831887
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion interpreter/core/llm/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ def load(self):
if self._is_loaded:
return

if self.model.startswith("ollama/") and not ":" in self.model:
self.model = self.model + ":latest"

self._is_loaded = True

if self.model.startswith("ollama/"):
Expand All @@ -323,7 +326,7 @@ def load(self):
if response.ok:
data = response.json()
names = [
model["name"].replace(":latest", "")
model["name"]
for model in data["models"]
if "name" in model and model["name"]
]
Expand Down Expand Up @@ -358,6 +361,7 @@ def load(self):
self.max_tokens = int(self.context_window * 0.2)

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

old_max_tokens = self.max_tokens
Expand Down Expand Up @@ -398,6 +402,8 @@ def fixed_litellm_completions(**params):
else:
litellm.drop_params = True

params["model"] = params["model"].replace(":latest", "")

# Run completion
attempts = 4
first_error = None
Expand Down
2 changes: 1 addition & 1 deletion interpreter/terminal_interface/local_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def download_model(models_dir, models, interpreter):
names=[name for name in names if not any(word.lower() in name.lower() for word in priority_models)]
names=priority_models_found+names

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

Expand Down

0 comments on commit f831887

Please sign in to comment.