File size: 7,174 Bytes
711a69b
 
 
1df4c13
711a69b
 
 
 
 
7741a44
 
 
 
 
 
1df4c13
 
 
 
 
 
711a69b
1df4c13
711a69b
 
1df4c13
 
 
 
 
 
 
711a69b
 
 
 
 
1df4c13
711a69b
 
 
 
 
1df4c13
711a69b
1df4c13
 
711a69b
 
 
 
1df4c13
711a69b
 
 
 
 
1df4c13
711a69b
 
 
 
 
1df4c13
711a69b
 
 
 
 
1df4c13
711a69b
 
 
 
 
1df4c13
711a69b
 
 
 
 
1df4c13
 
 
 
 
 
 
711a69b
 
 
 
 
1df4c13
 
 
 
 
 
 
 
 
 
 
 
 
711a69b
 
 
 
 
1df4c13
711a69b
 
 
 
 
1df4c13
711a69b
 
 
 
 
1df4c13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
711a69b
 
 
 
 
1df4c13
711a69b
 
 
 
 
1df4c13
711a69b
 
 
 
 
1df4c13
711a69b
eddb8ec
711a69b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1df4c13
711a69b
 
 
 
 
1df4c13
 
711a69b
 
 
 
 
 
 
 
 
1df4c13
711a69b
 
 
 
1df4c13
711a69b
 
 
 
 
 
 
 
 
 
 
 
 
 
1df4c13
711a69b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
import csv
import json
import locale
import os
from typing import Dict, Union

import pandas as pd

model_details = {
    "DeepSeek R1-0528": (
        "https://huggingface.co/deepseek-ai/DeepSeek-R1-0528",
        685,
        "General",
        "V2",
    ),
    "DeepSeek R1": (
        "https://huggingface.co/deepseek-ai/DeepSeek-R1",
        685,
        "General",
        "V1",
    ),
    "Llama 3.1 405B": (
        "https://huggingface.co/RedHatAI/Meta-Llama-3.1-405B-FP8",
        406,
        "General",
        "V1",
    ),
    "Qwen3 236B A22B": (
        "https://huggingface.co/Qwen/Qwen3-235B-A22B",
        235,
        "General",
        "V2",
    ),
    "Llama 3.(1-3) 70B": (
        "https://huggingface.co/meta-llama/Llama-3.3-70B-Instruct",
        70.6,
        "General",
        "V1",
    ),
    "Qwen2.5 72B": (
        "https://huggingface.co/Qwen/Qwen2.5-72B-Instruct",
        72.7,
        "General",
        "V1",
    ),
    "QwQ 32B": ("https://huggingface.co/Qwen/QwQ-32B", 32.8, "General", "V2"),
    "Qwen2.5 32B": ("https://huggingface.co/Qwen/Qwen2.5-32B", 32.5, "General", "V1"),
    "StarChat2 15B v0.1": (
        "https://huggingface.co/HuggingFaceH4/starchat2-15b-v0.1",
        16,
        "General",
        "V1",
    ),
    "DeepSeek R1 Distill Qwen 14B": (
        "https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-14B",
        14.8,
        "General",
        "V1",
    ),
    "CodeLlama 70B": (
        "https://huggingface.co/codellama/CodeLlama-70b-hf",
        69,
        "Coding",
        "V1",
    ),
    "QwenCoder 2.5 32B": (
        "https://huggingface.co/Qwen/Qwen2.5-Coder-32B-Instruct",
        32.5,
        "Coding",
        "V1",
    ),
    "DeepSeek Coder 33B": (
        "https://huggingface.co/deepseek-ai/deepseek-coder-33b-instruct",
        33.3,
        "Coding",
        "V1",
    ),
    "QwenCoder 2.5 14B": (
        "https://huggingface.co/Qwen/Qwen2.5-Coder-14B-Instruct",
        14.7,
        "Coding",
        "V1",
    ),
    "DeepCoder 14B": (
        "https://huggingface.co/agentica-org/DeepCoder-14B-Preview",
        14.8,
        "Coding",
        "V2",
    ),
    "OpenCoder 8B": (
        "https://huggingface.co/infly/OpenCoder-8B-Instruct",
        7.77,
        "Coding",
        "V1",
    ),
    "SeedCoder 8B": (
        "https://huggingface.co/ByteDance-Seed/Seed-Coder-8B-Instruct",
        8.25,
        "Coding",
        "V2",
    ),
    "SeedCoder 8B Reasoning": (
        "https://huggingface.co/ByteDance-Seed/Seed-Coder-8B-Reasoning-bf16",
        8.25,
        "Coding",
        "V2",
    ),
    "QwenCoder 2.5 7B": (
        "https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct",
        7.61,
        "Coding",
        "V1",
    ),
    "DeepSeek Coder 6,7B": (
        "https://huggingface.co/deepseek-ai/deepseek-coder-6.7b-instruct",
        6.74,
        "Coding",
        "V1",
    ),
    "HaVen-CodeQwen": (
        "https://huggingface.co/yangyiyao/HaVen-CodeQwen",
        7.25,
        "RTL-Specific",
        "V1",
    ),
    "CodeV R1 Distill Qwen 7B": (
        "https://huggingface.co/zhuyaoyu/CodeV-R1-Distill-Qwen-7B",
        7.62,
        "RTL-Specific",
        "V2",
    ),
    "CodeV-CL-7B": (
        "https://huggingface.co/yang-z/CodeV-CL-7B",
        6.74,
        "RTL-Specific",
        "V1",
    ),
    "CodeV-QW-7B": (
        "https://huggingface.co/yang-z/CodeV-QW-7B",
        7.25,
        "RTL-Specific",
        "V1",
    ),
    "CodeV-DS-6.7B": (
        "https://huggingface.co/yang-z/CodeV-DS-6.7B",
        6.74,
        "RTL-Specific",
        "V1",
    ),
    "RTLCoder Mistral": (
        "https://huggingface.co/ishorn5/RTLCoder-v1.1",
        7.24,
        "RTL-Specific",
        "V1",
    ),
    "RTLCoder DeepSeek": (
        "https://huggingface.co/ishorn5/RTLCoder-Deepseek-v1.1",
        6.74,
        "RTL-Specific",
        "V1",
    ),
    "OriGen": ("https://huggingface.co/henryen/OriGen", 6.74, "RTL-Specific", "V1"),
}


def get_headers(reader, agg=False) -> Union[list, list]:
    metrics, benchs = [], []
    for i, row in enumerate(reader):
        if i == 0:
            metrics = row[1:]
        elif i == 1 and not agg:
            benchs = row[1:]
            break
        else:
            return metrics
    return metrics, benchs


def get_model_params_and_url(model) -> Union[str, str, float, str]:
    if model not in model_details:
        return "-", "-", "-"
    url = model_details[model][0]
    params = model_details[model][1]
    type = model_details[model][2]
    release = model_details[model][3]
    return url, params, type, release


def parse_results(csv_path: str) -> list[dict]:
    """
    Each row has the following format:
        MODEL | BENCHMARK | TASK | METRIC | RESULT
    """
    dataset = []
    models = []
    with open(os.path.join("results", csv_path), newline="") as csvfile:
        reader = csv.reader(csvfile, delimiter=",")
        metrics, benchs = get_headers(reader)
        for i, row in enumerate(reader):
            model = row[0]
            url, params, type, release = get_model_params_and_url(model)
            models.append(model)
            row = row[1:]
            ctr = 0
            for metric, bench in zip(metrics, benchs):
                if metric == "EM":
                    metric = "Exact Matching (EM)"
                record = {}
                record["Model"] = model
                record["Model Type"] = type
                record["Benchmark"] = bench
                record["Task"] = metric
                record["Result"] = float(row[ctr].replace(",", "."))
                record["Model URL"] = url
                record["Params"] = params
                record["Release"] = release
                dataset.append(record)
                ctr += 1
    print(models)
    return dataset


def parse_agg(csv_path: str) -> list[dict]:
    """
    Each row has the following format:
        MODEL | BENCHMARK | TASK | METRIC | RESULT
    """
    return pd.read_csv("results/aggregated_scores.csv")


def writeJson(data: list):
    with open("results/results.json", "w") as f:
        json.dump(data, f, indent=4, ensure_ascii=False)
    print("Done")


def read_json():
    json_path = "results/results.json"
    with open(json_path, "r", encoding="utf-8") as file:
        data = json.load(file)
    return data


def read_data() -> Union[pd.DataFrame, list, list, str]:
    data = read_json()
    df = pd.DataFrame(data)
    df.rename(
        columns={
            "Model": "Model",
            "Benchmark": "Benchmark",
            "Task": "Metric",
            "Result": "Score",
            "EM": "Exact Matching (EM)",
        },
        inplace=True,
    )
    df["Params"] = pd.to_numeric(df["Params"], errors="coerce")
    benchmarks = sorted(df["Benchmark"].unique().tolist(), reverse=True)
    metrics = df["Metric"].unique().tolist()
    default_metric = (
        "Functionality (FNC)" if "Functionality (FNC)" in metrics else metrics[0]
    )
    return df, benchmarks, metrics, default_metric


if __name__ == "__main__":
    csv_path = "./results.csv"
    d = parse_results(csv_path)
    writeJson(d)