File size: 2,014 Bytes
9a99a04
 
 
2d8f35a
9a99a04
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2d8f35a
 
 
 
 
 
 
 
 
 
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
// Regenerate models.json + models.csv from the live ModelFit dataset endpoint.
// Usage: node generate.mjs   (then commit the changes)
// The canonical source is https://modelfit.io/api/dataset/ (CC BY 4.0).
import { readFileSync, writeFileSync } from 'node:fs';

const SRC = 'https://modelfit.io/api/dataset/';
const UA = 'modelfit-hardware-dataset/1.0 (+https://modelfit.io/data/)';

const res = await fetch(SRC, { headers: { 'user-agent': UA, accept: 'application/json' } });
if (!res.ok) {
  console.error(`Fetch failed: HTTP ${res.status}`);
  process.exit(1);
}
const data = await res.json();

writeFileSync('models.json', JSON.stringify(data, null, 2) + '\n');

const cols = ['model', 'family', 'params', 'quantization', 'minRamGb', 'estimatedLoadGb', 'kvKbPerToken', 'runsLocally', 'openWeights', 'ggufDiy', 'runtimes', 'bestFor', 'ollamaCommand'];
const esc = (v) => {
  if (Array.isArray(v)) v = v.join('|');
  const s = v === null || v === undefined ? '' : String(v);
  return /[",\n]/.test(s) ? `"${s.replace(/"/g, '""')}"` : s;
};
const csv = [cols.join(',')]
  .concat(data.models.map((r) => cols.map((c) => esc(r[c])).join(',')))
  .join('\n');
writeFileSync('models.csv', csv + '\n');

// Keep the headline counts of the Hugging Face card in step with the data.
const total = data.models.length;
const local = data.models.filter((r) => r.runsLocally).length;
const closed = data.models.filter((r) => !r.runsLocally && !r.openWeights).length;
const families = new Set(data.models.map((r) => r.family)).size;
const line = `- **${total} models** across ${families} families (${local} with a registry-verified local build, ${total - local - closed} open-weight models without a consumer-tier Ollama build, ${closed} closed cloud APIs tracked for comparison)`;
const card = readFileSync('hf-card.md', 'utf8');
writeFileSync('hf-card.md', card.replace(/^- \*\*\d+ models\*\* across .*$/m, line));

console.log(`Wrote ${total} models (updated ${data.updated}) to models.json + models.csv + hf-card.md`);