File tree Expand file tree Collapse file tree 4 files changed +336
-660
lines changed Expand file tree Collapse file tree 4 files changed +336
-660
lines changed Original file line number Diff line number Diff line change @@ -239,7 +239,7 @@ def extract_code_blocks(text: str) -> List[str]:
239
239
from the text.
240
240
241
241
"""
242
- pattern = r" ```python\n (.*?)```"
242
+ pattern = r'(?s) ```(?: python|py)? (.*?)```'
243
243
matches = re .finditer (pattern , text , re .DOTALL )
244
244
return [match .group (1 ).strip () for match in matches ]
245
245
Original file line number Diff line number Diff line change 1
- from typing import List
1
+ from typing import Dict , List
2
2
from datasets import Dataset
3
3
from vllm import LLM , SamplingParams
4
4
from examples .star .utils import generate_prompt , cleanup
@@ -28,14 +28,14 @@ def generate_predictions(
28
28
sampling_params = SamplingParams (n = n , temperature = temperature , max_tokens = 512 )
29
29
llm = LLM (model = model_name )
30
30
31
- prompts : List [str ] = []
31
+ prompts : List [List [ Dict ] ] = []
32
32
for example in dataset :
33
33
prompt = example ["prompt" ]
34
34
test = example ["test" ]
35
35
prompt = generate_prompt (prompt , test )
36
- prompts .append (prompt )
36
+ prompts .append ([{ "role" : "user" , "content" : prompt }] )
37
37
38
- outputs = llm .generate (prompts , sampling_params )
38
+ outputs = llm .chat (prompts , sampling_params )
39
39
40
40
results : List [List [str ]] = []
41
41
for output in outputs :
Original file line number Diff line number Diff line change @@ -36,14 +36,15 @@ packages = ["commit0", "agent"]
36
36
agent = [
37
37
" import-deps>=0.3.0" ,
38
38
" PyMuPDF>=1.24.5" ,
39
- " aider-chat" ,
39
+ # "aider-chat>=0.69.1 ",
40
40
]
41
41
example = [
42
- " vllm" ,
43
- " transformers" ,
42
+ " vllm==0.6.5 " ,
43
+ " transformers>=4.47.1 " ,
44
44
" setuptools" ,
45
45
" accelerate" ,
46
46
" wandb>=0.19.0" ,
47
+ " openai>=1.58.1" ,
47
48
]
48
49
49
50
[project .urls ]
You can’t perform that action at this time.
0 commit comments