Skip to content

Commit 063676c

Browse files
committedApr 16, 2024
add bash script for ruunning
1 parent de9b23a commit 063676c

File tree

2 files changed

+10
-37
lines changed

2 files changed

+10
-37
lines changed
 

‎script/apieval_openai.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,3 @@
1-
"""Testing
2-
from datasets import load_dataset
3-
4-
ds = load_dataset("bigcode/humaneval-x-bugs", "python")["test"]
5-
idx = 0
6-
7-
def get_prompt_base(doc, language="python"):
8-
# See
9-
# https://github.com/roG0d/CodeGeeX/blob/f66205b5f615a4eead9c26d7ec297e14738ea18d/codegeex/benchmark/evaluate_humaneval_x.py#L78
10-
# https://github.com/THUDM/CodeGeeX/pull/76#issuecomment-1500653190
11-
if language == "rust":
12-
main = "fn main(){}\n"
13-
prompt_base = main + doc["declaration"] + doc["prompt"]
14-
else:
15-
prompt_base = doc["prompt"]
16-
return prompt_base
17-
18-
prompt_base = get_prompt_base(ds[idx], language="python")
19-
20-
messages = [
21-
{
22-
"role": "user",
23-
"content": ds[idx]["instruction"],
24-
},
25-
{
26-
"role": "assistant",
27-
"content": prompt_base,
28-
},
29-
]
30-
31-
gpt-4-0613
32-
response = openai.ChatCompletion.create(
33-
model="gpt-4-0613",
34-
messages=messages
35-
)
36-
"""
37-
381
import os
392
import openai
403
from openai import OpenAI

‎script/run.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# Loop through all python files in the current directory
4+
for file in data/processed/*.py; do
5+
pytest "$file"
6+
if [ $? -ne 0 ]; then
7+
echo "Pytest failed on $file, stopping..."
8+
exit 1
9+
fi
10+
done

0 commit comments

Comments
 (0)
Please sign in to comment.