Skip to content

Commit

Permalink
add bash script for ruunning
Browse files Browse the repository at this point in the history
  • Loading branch information
terryyz committed Apr 16, 2024
1 parent de9b23a commit 063676c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 37 deletions.
37 changes: 0 additions & 37 deletions script/apieval_openai.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,3 @@
"""Testing
from datasets import load_dataset
ds = load_dataset("bigcode/humaneval-x-bugs", "python")["test"]
idx = 0
def get_prompt_base(doc, language="python"):
# See
# https://github.com/roG0d/CodeGeeX/blob/f66205b5f615a4eead9c26d7ec297e14738ea18d/codegeex/benchmark/evaluate_humaneval_x.py#L78
# https://github.com/THUDM/CodeGeeX/pull/76#issuecomment-1500653190
if language == "rust":
main = "fn main(){}\n"
prompt_base = main + doc["declaration"] + doc["prompt"]
else:
prompt_base = doc["prompt"]
return prompt_base
prompt_base = get_prompt_base(ds[idx], language="python")
messages = [
{
"role": "user",
"content": ds[idx]["instruction"],
},
{
"role": "assistant",
"content": prompt_base,
},
]
gpt-4-0613
response = openai.ChatCompletion.create(
model="gpt-4-0613",
messages=messages
)
"""

import os
import openai
from openai import OpenAI
Expand Down
10 changes: 10 additions & 0 deletions script/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Loop through all python files in the current directory
for file in data/processed/*.py; do
pytest "$file"
if [ $? -ne 0 ]; then
echo "Pytest failed on $file, stopping..."
exit 1
fi
done

0 comments on commit 063676c

Please sign in to comment.