Skip to content

Commit 63b1c85

Browse files
authored
Merge pull request #820 from kvcache-ai/develop-0.2.3
Develop 0.2.3 ready to release
2 parents 1bcfce8 + 407e1b9 commit 63b1c85

File tree

5 files changed

+28
-13
lines changed

5 files changed

+28
-13
lines changed

ktransformers/ktransformers_ext/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ elseif (CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64" OR CMAKE_GENERATOR_PLATFORM_LW
175175
list(APPEND ARCH_FLAGS -mavx512bw)
176176
list(APPEND ARCH_FLAGS -mavx512dq)
177177
list(APPEND ARCH_FLAGS -mavx512vnni)
178+
list(APPEND ARCH_FLAGS -mavx512vpopcntdq)
178179
endif()
179180
if (LLAMA_AVX512_BF16)
180181
list(APPEND ARCH_FLAGS -mavx512bf16)

ktransformers/tests/AIME_2024/eval_api.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,15 @@ def run_eval_api(
7878
format_tabs: bool = False,
7979
auth_token: str = None,
8080
problem_file: str = None,
81-
append: bool = False
81+
append: bool = False,
82+
skip: int = 0
8283
):
8384

8485
data = load_data(problem_file)
8586
pbar = tqdm.tqdm(total=len(data) * 1)
86-
87+
pbar.update(skip)
8788
for i in range(len(data)):
89+
i = i+skip
8890
data_item = data[i]
8991
question = data_item['Problem']
9092
# Start the timer for this evaluation
@@ -97,6 +99,7 @@ def run_eval_api(
9799
score = get_score(completion, answer)
98100
elapsed_time = time.time() - start_time
99101
result = {
102+
"index": i,
100103
"question_id": data_item["ID"],
101104
"answer": answer,
102105
"prediction": completion,
@@ -114,9 +117,9 @@ def run_eval_api(
114117
pbar.update(1)
115118

116119

117-
def main(output_path, api_url, model_name, auth_token, format_tabs,problem_file, append):
120+
def main(output_path, api_url, model_name, auth_token, format_tabs,problem_file, append,skip):
118121
os.makedirs(os.path.dirname(output_path), exist_ok=True)
119-
run_eval_api(api_url, model_name, output_path, format_tabs, auth_token, problem_file,append)
122+
run_eval_api(api_url, model_name, output_path, format_tabs, auth_token, problem_file,append,skip)
120123

121124

122125
if __name__ == "__main__":
@@ -128,6 +131,7 @@ def main(output_path, api_url, model_name, auth_token, format_tabs,problem_file,
128131
parser.add_argument("--format_tabs", action="store_true", help="Format Tabs")
129132
parser.add_argument("--problem_file", type=str, default="Maxwell-Jia/AIME_2024", help="Evalset File")
130133
parser.add_argument("--no_append", action="store_false", help="Append to existing file")
134+
parser.add_argument("--skip", type=int, default=0, help="Skip some tasks")
131135
args = parser.parse_args()
132136
# api_url = "https://api.siliconflow.cn/v1/chat/completions"
133-
main(args.out_path, args.api_url, args.model_name, args.auth_token, args.format_tabs, args.problem_file, args.no_append)
137+
main(args.out_path, args.api_url, args.model_name, args.auth_token, args.format_tabs, args.problem_file, args.no_append, args.skip)

ktransformers/tests/humaneval/eval_api.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,23 @@ def run_eval_api(
3939
format_tabs: bool = False,
4040
auth_token: str = None,
4141
problem_file: str = None,
42-
append: bool = False
42+
append: bool = False,
43+
skip: int = 0
4344
):
4445
if(problem_file is None):
4546
problems = read_problems()
4647
else:
4748
problems = read_problems(problem_file)
4849
samples = []
4950
pbar = tqdm.tqdm(total=len(problems) * 1)
51+
pbar.update(skip)
5052
try:
5153
for task_id in problems:
54+
# skip some tasks
55+
if skip > 0:
56+
skip -= 1
57+
continue
58+
5259
if format_tabs:
5360
prompt = problems[task_id]["prompt"].replace(" ", "\t")
5461
else:
@@ -67,23 +74,25 @@ def run_eval_api(
6774
if not append:
6875
write_jsonl(out_path, samples,append=append)
6976
except Exception as e:
70-
write_jsonl(out_path, samples,append=append)
77+
if not append:
78+
write_jsonl(out_path, samples,append=append)
7179
print(f"Error: {e}")
7280

73-
def main(output_path, api_url, model_name, auth_token, format_tabs,problem_file, append):
81+
def main(output_path, api_url, model_name, auth_token, format_tabs,problem_file, append,skip):
7482
os.makedirs(os.path.dirname(output_path), exist_ok=True)
75-
run_eval_api(api_url, model_name, output_path, format_tabs, auth_token, problem_file,append)
83+
run_eval_api(api_url, model_name, output_path, format_tabs, auth_token, problem_file,append,skip)
7684

7785

7886
if __name__ == "__main__":
7987
parser = argparse.ArgumentParser(description="API Generate Tester")
8088
parser.add_argument("--api_url", type=str, default="https://api.siliconflow.cn/v1/chat/completions", help="API URL")
8189
parser.add_argument("--model_name", type=str, default="Pro/deepseek-ai/DeepSeek-V3", help="Model Name")
82-
parser.add_argument("--out_path", type=str, default="results/api/eval.jsonl", help="Output Path")
90+
parser.add_argument("--out_path", type=str, default="results/api/eval_b.jsonl", help="Output Path")
8391
parser.add_argument("--auth_token", type=str, default=None, help="Auth Token")
8492
parser.add_argument("--format_tabs", action="store_true", help="Format Tabs")
8593
parser.add_argument("--problem_file", type=str, default=None, help="Evalset File")
8694
parser.add_argument("--no_append", action="store_false", help="Append to existing file")
95+
parser.add_argument("--skip", type=int, default=0, help="Skip first n problems")
8796
args = parser.parse_args()
8897
# api_url = "https://api.siliconflow.cn/v1/chat/completions"
89-
main(args.out_path, args.api_url, args.model_name, args.auth_token, args.format_tabs, args.problem_file, args.no_append)
98+
main(args.out_path, args.api_url, args.model_name, args.auth_token, args.format_tabs, args.problem_file, args.no_append,args.skip)

ktransformers/tests/humaneval/evaluation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def filter_code(completion: str) -> str:
88
completion = completion.split('if __name__ == "__main__":')[0]
99
if "# Example usage" in completion:
1010
completion = completion.split("# Example usage")[0]
11-
return completion.split("\n\n")[0]
11+
return completion
1212

1313

1414
def fix_indents(text: str) -> str:

third_party/llamafile/iqk_mul_mat.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2388,7 +2388,8 @@ struct SimpleBits {
23882388

23892389

23902390
struct EvenSignHelper {
2391-
#ifdef HAVE_FANCY_SIMD
2391+
#if defined HAVE_FANCY_SIMD
2392+
// #pragma message("Using AVX512VPOPCNTDQ in even sign helper")
23922393
union sbits_t {
23932394
__m128i vec;
23942395
__mmask32 mask[4];

0 commit comments

Comments
 (0)