|
import csv |
|
import json |
|
|
|
|
|
mapping = { |
|
"humaneval": "humaneval-python", |
|
"multiple-lua": "lua", |
|
"multiple-java": "java", |
|
"multiple-jl": "julia", |
|
"multiple-cpp": "cpp", |
|
"multiple-rs": "rust", |
|
"multiple-rkt": "racket", |
|
"multiple-php": "php", |
|
"multiple-r": "r", |
|
"multiple-js": "javascript", |
|
"multiple-d": "d", |
|
"multiple-swift": "swift" |
|
} |
|
BASE_PATH = "/fsx/loubna/projects/bigcode-models-leaderboard" |
|
|
|
|
|
json_path = f"/fsx/loubna/projects/bigcode-models-leaderboard/community_results/codeqwen/Qwen_CodeQwen1.5-7B-Chat_loubnabnl.json" |
|
with open(json_path, "r") as f: |
|
json_data = json.load(f) |
|
parsed_data = json_data['results'] |
|
|
|
|
|
csv_columns = ["Models", "Size (B)", "Throughput (tokens/s)", "Seq_length", "#Languages", "humaneval-python", "java", "javascript", "cpp", "php", "julia", "d", "lua", "r", "racket", "rust", "swift", "Throughput (tokens/s) bs=50", "Peak Memory (MB)"] |
|
row_data = {col: '' for col in csv_columns} |
|
|
|
|
|
for item in parsed_data: |
|
csv_col = mapping.get(item['task']) |
|
if csv_col: |
|
row_data[csv_col] = round(item['pass@1'] * 100, 2) |
|
|
|
|
|
row_data['Models'] = json_data['meta']['model'] |
|
|
|
|
|
csv_file = f"{BASE_PATH}/data/raw_scores.csv" |
|
with open(csv_file, 'a', newline='') as csvfile: |
|
writer = csv.DictWriter(csvfile, fieldnames=row_data.keys()) |
|
writer.writerow(row_data) |
|
|
|
|
|
with open(csv_file, 'r') as f: |
|
lines = f.readlines() |
|
for line in lines[-3:]: |
|
print(line) |
|
|