Spaces:
Running
Running
Download chart.js from Valen-Team/JevalKit-Leaderboard: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/spaces/Valen-Team/JevalKit-Leaderboard/resolve/main/chart.js
- Command line
-
hf download hf://spaces/Valen-Team/JevalKit-Leaderboard/chart.js
-
curl -L -o chart.js https://huggingface.co/spaces/Valen-Team/JevalKit-Leaderboard/resolve/main/chart.js
1.26 kB
| import { METRICS, sortedModels, valueOf } from './ranking.js'; | |
| export function parameterSize(model) { | |
| const size = model.parameters_b; | |
| return typeof size === 'number' && Number.isFinite(size) && size > 0 ? size : null; | |
| } | |
| export function sizeMatches(model, { min, max, includeUnknown }) { | |
| const size = parameterSize(model); | |
| return size === null ? includeUnknown : size >= min && size <= max; | |
| } | |
| export function chartModels(models, map, state) { | |
| return sortedModels(models.filter(model => sizeMatches(model, state) | |
| && valueOf(map.get(`${model.id}|${state.benchmark}`), state.metric) !== null), | |
| map, state.benchmark, state.metric); | |
| } | |
| export function chartAxis(values, metric) { | |
| if (metric === 'accuracy' || metric === 'public_decision_index') return 100; | |
| const peak = Math.max(0, ...values.filter(Number.isFinite)); | |
| if (peak === 0) return 1; | |
| const magnitude = 10 ** Math.floor(Math.log10(peak)); | |
| return Math.ceil(peak / magnitude * 2) / 2 * magnitude; | |
| } | |
| export function plotValue(value, metric) { | |
| return metric === 'accuracy' ? value * 100 : value; | |
| } | |
| export function axisLabel(value, metric) { | |
| const label = Number(value.toPrecision(3)).toString(); | |
| return label + (metric === 'accuracy' ? '%' : METRICS[metric].unit || ''); | |
| } | |