MCPcopy Create free account
hub / github.com/OpenCodeInterpreter/OpenCodeInterpreter / main

Function main

evaluation/evalplus/evalplus/perf/sas.py:101–162  ·  view source on GitHub ↗
(
    output: str,  # output file
    n: int = 16,  # sample size and batch size
    model: Optional[str] = "TheBloke/deepseek-coder-33B-instruct-AWQ",
    port: str = 8088,
)

Source from the content-addressed store, hash-verified

99
100
101def main(
102 output: str, # output file
103 n: int = 16, # sample size and batch size
104 model: Optional[str] = "TheBloke/deepseek-coder-33B-instruct-AWQ",
105 port: str = 8088,
106):
107 assert output.endswith(".jsonl"), "output must be a .jsonl file"
108
109 base_url = f"http://localhost:{port}/v1"
110 print(f"Trying to query vLLM model: {model} at {base_url}")
111 print(f"Note: To use SaS, you need to first set up a vLLM server for {model}")
112 print(f"For example:")
113 print(
114 f"""python -m vllm.entrypoints.openai.api_server \\
115--model "{model}" \\
116--port {port} \\
117--tensor-parallel-size 2 \\
118--max-num-seqs 16 \\
119--gpu-memory-utilization 1.0"""
120 )
121
122 # "task_id" -> { "task_id", "entry_point", "ref_code", }
123 tasks = {}
124 for task_id, item in get_human_eval_plus().items():
125 tasks[task_id] = {
126 "task_id": task_id,
127 "entry_point": item["entry_point"],
128 "ref_code": item["prompt"] + item["canonical_solution"],
129 }
130
131 for task_id, item in get_mbpp_plus().items():
132 tasks[task_id] = {
133 "task_id": task_id,
134 "entry_point": item["entry_point"],
135 "ref_code": item["prompt"] + item["canonical_solution"],
136 }
137
138 # Using vLLM as a backend, please make sure that a vLLM server is available first.
139 # vLLM document: https://docs.vllm.ai/en/latest/
140 client = openai.OpenAI(api_key="none", base_url=base_url)
141
142 with open(output, "w") as f:
143 for task_id, item in tqdm(tasks.items(), total=len(tasks)):
144 responses = fewshot_cot(
145 task_id=task_id,
146 client=client,
147 entry_point=item["entry_point"],
148 code=item["ref_code"],
149 model=model,
150 n=n,
151 )
152 f.write(
153 json.dumps(
154 {
155 "task_id": task_id,
156 "ref_code": item["ref_code"],
157 "synthesizers": responses,
158 }

Callers

nothing calls this directly

Calls 3

get_human_eval_plusFunction · 0.90
get_mbpp_plusFunction · 0.90
fewshot_cotFunction · 0.85

Tested by

no test coverage detected