Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ollama llama3.1 loading fix #1400

Merged
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
Loading