Skip to content

Commit

Permalink
hax to run against local starcoder/wizardcoder models
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 committed Jul 18, 2023
1 parent f891196 commit de1616e
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 13 deletions.
3 changes: 2 additions & 1 deletion aider/coders/base_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,8 @@ def show_send_output_stream(self, completion, silent):

for chunk in completion:
if chunk.choices[0].finish_reason == "length":
raise ExhaustedContextWindow()
pass
#raise ExhaustedContextWindow()

try:
func = chunk.choices[0].delta.function_call
Expand Down
1 change: 1 addition & 0 deletions aider/coders/wholefile_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def update_files(self, mode="update"):
if i > 0:
fname_source = "block"
fname = lines[i - 1].strip()
fname = fname.strip("*") # handle **filename.py** from wizardcoder
# Did gpt prepend a bogus dir? It especially likes to
# include the path/to prefix from the one-shot example in
# the prompt.
Expand Down
6 changes: 2 additions & 4 deletions aider/coders/wholefile_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
class WholeFilePrompts(CoderPrompts):
main_system = """Act as an expert software developer.
Take requests for changes to the supplied code.
If the request is ambiguous, ask questions.
Once you understand the request you MUST:
1. Determine if any code changes are needed.
1. Determine what code changes are needed.
2. Explain any needed changes.
3. If changes are needed, output a copy of each file that needs changes.
3. Output a copy of each file that needs changes.
"""

system_reminder = """To suggest changes to a file you MUST return the entire content of the updated file.
Expand Down
2 changes: 1 addition & 1 deletion aider/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Commands:
def __init__(self, io, coder):
self.io = io
self.coder = coder
self.tokenizer = tiktoken.encoding_for_model(coder.main_model.name)
self.tokenizer = tiktoken.encoding_for_model('gpt-4') #coder.main_model.name)

def is_command(self, inp):
if inp[0] == "/":
Expand Down
5 changes: 3 additions & 2 deletions aider/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def __init__(self, name):
tokens = t

if tokens is None:
raise ValueError(f"Unknown context window size for model: {name}")
tokens = 1
#raise ValueError(f"Unknown context window size for model: {name}")

self.max_context_tokens = tokens * 1024

Expand All @@ -46,7 +47,7 @@ def __init__(self, name):

return

if self.is_gpt35():
if self.is_gpt35() or True:
self.edit_format = "whole"
self.always_available = True

Expand Down
2 changes: 1 addition & 1 deletion benchmark/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM python:3.8-slim
RUN apt-get update && apt-get install -y less git
RUN apt-get update && apt-get install -y less git vim
COPY requirements.txt /aider/requirements.txt
RUN pip install lox typer pandas matplotlib imgcat aider-chat
RUN pip install --upgrade pip && pip install -r /aider/requirements.txt
Expand Down
4 changes: 3 additions & 1 deletion benchmark/benchmark.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import datetime
import json
Expand Down Expand Up @@ -509,6 +509,8 @@ def run_test(
print("fnames:", show_fnames)

openai.api_key = os.environ["OPENAI_API_KEY"]
if os.environ.get("OPENAI_API_BASE") is not None:
openai.api_base = os.environ["OPENAI_API_BASE"]

coder = Coder.create(
main_model,
Expand Down
1 change: 1 addition & 0 deletions benchmark/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ docker run \
-it --rm \
-v `pwd`:/aider \
-v `pwd`/tmp.benchmarks/.:/benchmarks \
-e OPENAI_API_BASE=http://10.0.1.3:5001/v1 \
-e OPENAI_API_KEY=$OPENAI_API_KEY \
-e HISTFILE=/aider/.bash_history \
-e AIDER_DOCKER=1 \
Expand Down
7 changes: 4 additions & 3 deletions benchmark/rungrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
def main():
models = [
# "gpt-3.5-turbo-0301",
"gpt-3.5-turbo-0613",
#"gpt-3.5-turbo-0613",
# "gpt-3.5-turbo-16k-0613",
# "gpt-4-0314",
# "gpt-4-0613",
"starcoderplus",
]
edit_formats = [
# "diff",
Expand All @@ -21,7 +22,7 @@ def main():
# "whole-func",
]

for repeat in range(1, 10, 1):
for repeat in range(1, 2, 1):
for model in models:
for edit_format in edit_formats:
# dump(model, edit_format)
Expand All @@ -47,7 +48,7 @@ def run(dirname, model, edit_format):
"--edit-format",
edit_format,
"--threads",
"10",
"1",
"--cont",
]
print(" ".join(cmd))
Expand Down

0 comments on commit de1616e

Please sign in to comment.