inspector / style.css
lysandre's picture
lysandre HF Staff
Deploy architecture inspector
ed5700a verified
Raw
History Blame Contribute Delete
20.7 kB
/* Transformers Architecture Viewer — Hugging Face-flavoured styling.
Dark theme by default (matches the HF Hub dark UI); `body.light` opts into
the light palette. All colours flow through CSS variables so the SVG graph
themes along with the chrome. */
:root {
/* Dark (default) */
--bg: #0a0c12;
--panel: #10131c;
--panel-2: #171b26;
--border: #232838;
--border-strong: #313850;
--text: #e8eaf1;
--text-muted: #939ab0;
--text-faint: #646b80;
--accent: #ff9d00;
--accent-strong: #ffb020;
--accent-ink: #241701; /* text on an orange button */
--accent-soft: rgba(255, 157, 0, 0.14);
--node-bg: #161a26;
--node-border: #2c3346;
--group-bg: rgba(255, 255, 255, 0.028);
--group-header-bg: rgba(255, 255, 255, 0.05);
--grid-dot: rgba(255, 255, 255, 0.045);
--overlay: rgba(16, 19, 28, 0.92);
--shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
--radius: 12px;
--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}
body.light {
--bg: #f6f7f9;
--panel: #ffffff;
--panel-2: #f2f4f7;
--border: #e4e7ec;
--border-strong: #d0d5dd;
--text: #1f2733;
--text-muted: #667085;
--text-faint: #98a2b3;
--accent: #ff9d00;
--accent-strong: #f97316;
--accent-ink: #ffffff;
--accent-soft: #fff4e5;
--node-bg: #ffffff;
--node-border: #d0d5dd;
--group-bg: rgba(255, 255, 255, 0.35);
--group-header-bg: #f2f4f7;
--grid-dot: #e7eaee;
--overlay: rgba(255, 255, 255, 0.92);
--shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
}
* { box-sizing: border-box; }
html, body {
margin: 0;
height: 100%;
font-family: var(--sans);
color: var(--text);
background: var(--bg);
font-size: 14px;
}
body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
/* Header */
.app-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
padding: 12px 20px;
background: var(--panel);
border-bottom: 1px solid var(--border);
flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 14px; }
.app-header h1 { font-size: 16px; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
.header-actions { display: flex; gap: 8px; }
/* Layout */
.layout { flex: 1 1 auto; display: grid; grid-template-columns: 288px 1fr 320px; min-height: 0; }
.sidebar, .inspector {
background: var(--panel);
overflow-y: auto;
padding: 16px;
}
.sidebar { border-right: 1px solid var(--border); }
.inspector { border-left: 1px solid var(--border); }
.canvas {
position: relative;
min-width: 0;
background:
radial-gradient(circle at 1px 1px, var(--grid-dot) 1px, transparent 0) 0 0 / 22px 22px,
var(--bg);
}
/* Panels */
.panel { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.panel:last-child { border-bottom: none; }
.panel h2, .inspector h2 {
font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
color: var(--text-faint); margin: 0 0 10px; font-weight: 600;
}
.note { color: var(--text-muted); font-size: 12px; margin: 8px 0 0; line-height: 1.4; }
.note code { font-family: var(--mono); font-size: 11px; background: var(--panel-2); padding: 1px 4px; border-radius: 4px; }
.note.modularity { color: var(--accent-strong); }
.note.modularity:empty { display: none; }
.note.facts { color: var(--text); font-weight: 550; text-transform: capitalize; }
.note.facts:empty { display: none; }
/* Capability chips (sidebar + inspector) */
.cap-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.sidebar-chips { margin: 8px 0 0; }
.sidebar-chips:empty { display: none; }
.cap-chip {
font-size: 11px; font-family: var(--mono); line-height: 1;
padding: 3px 7px; border-radius: 999px;
background: var(--panel-2); color: var(--text-muted); border: 1px solid var(--border);
}
.cap-chip.on { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }
.cap-chip.arch { color: var(--text); border-color: var(--border-strong); font-weight: 550; }
/* Attention-schedule grid + legend (inspector) */
.sched-summary { font-size: 11.5px; color: var(--text-muted); margin-bottom: 8px; font-family: var(--mono); }
.sched-grid { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 8px; }
.pat-cell { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: 0 0 auto; }
.sched-legend { display: flex; flex-wrap: wrap; gap: 12px; }
.sched-leg-item { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-muted); }
.field-label { display: block; font-size: 12px; color: var(--text-muted); font-weight: 550; margin: 12px 0 6px; }
.field-label:first-child { margin-top: 0; }
/* Controls */
.btn {
font: inherit; font-size: 13px; font-weight: 550;
padding: 7px 12px; border-radius: 8px; cursor: pointer;
border: 1px solid var(--accent-strong); background: var(--accent-strong); color: var(--accent-ink);
transition: filter .12s ease, background .12s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--panel); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--panel-2); filter: none; }
.row-btns { display: flex; gap: 8px; margin-top: 8px; }
.select, .code-area {
width: 100%; font: inherit; color: var(--text);
border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel-2);
}
.select { padding: 8px; font-size: 13px; }
.code-area {
font-family: var(--mono); font-size: 11.5px; line-height: 1.5;
padding: 10px; margin-top: 8px; resize: vertical; min-height: 180px; background: var(--bg);
}
.code-area.small { min-height: 90px; }
.code-area:focus, .select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
/* Canvas */
.graph { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.graph.grabbing { cursor: grabbing; }
.status {
position: absolute; top: 12px; left: 12px;
background: var(--overlay); border: 1px solid var(--border);
border-radius: 8px; padding: 6px 10px; font-size: 12px; color: var(--text-muted);
box-shadow: var(--shadow); pointer-events: none; max-width: 70%;
}
.status.error { color: #ff9d94; border-color: #7a2820; background: rgba(122, 40, 32, .25); }
.hint {
position: absolute; bottom: 12px; right: 12px;
font-size: 11.5px; color: var(--text-faint); background: var(--overlay);
padding: 4px 8px; border-radius: 6px; pointer-events: none;
}
/* Spec-tier selector + feature toggles (bottom-left overlay) */
.spec-panel {
position: absolute; bottom: 12px; left: 12px;
display: flex; flex-direction: column; gap: 8px;
background: var(--overlay); border: 1px solid var(--border);
border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow);
}
body.compare .spec-panel { display: none; }
.spec-row { display: flex; align-items: center; gap: 8px; }
.spec-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 600; }
.spec-seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 7px; overflow: hidden; }
.spec-btn {
font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
padding: 3px 9px; border: none; background: var(--panel); color: var(--text-muted);
border-right: 1px solid var(--border);
}
.spec-btn:last-child { border-right: none; }
.spec-btn:hover { background: var(--panel-2); color: var(--text); }
.spec-btn.active { background: var(--accent-strong); color: var(--accent-ink); }
.spec-toggle { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text); cursor: pointer; }
.spec-toggle input { accent-color: var(--accent-strong); }
/* --- Graph nodes --- */
.node { cursor: grab; }
.node-box { fill: var(--node-bg); stroke: var(--node-border); stroke-width: 1.25; }
.node:hover .node-box { stroke: var(--accent); }
.node.selected .node-box { stroke: var(--accent-strong); stroke-width: 2; }
.node-title { font-size: 13px; font-weight: 600; fill: var(--text); pointer-events: none; }
.node-sub { font-size: 11px; fill: var(--text-muted); pointer-events: none; }
.node-info { font-size: 10.5px; font-family: var(--mono); fill: var(--text-faint); pointer-events: none; }
.kind-bar { fill: var(--text-faint); }
.kind-dot { fill: var(--text-faint); }
/* Kind accent colours: colour the left bar, the dot AND tint the box fill so
each role reads at a glance (like a coloured panel). */
.node-leaf .node-box { fill: color-mix(in srgb, var(--kind, #64748b) 12%, var(--node-bg)); stroke: color-mix(in srgb, var(--kind, #64748b) 34%, var(--node-border)); }
.node-leaf:hover .node-box { stroke: var(--kind, var(--accent)); }
[data-kind="attention"] { --kind: #fb923c; }
[data-kind="cross_attention"] { --kind: #f472b6; }
[data-kind="feed_forward"] { --kind: #2dd4bf; }
[data-kind="projection"] { --kind: #d97706; }
[data-kind="moe"] { --kind: #f59e0b; }
[data-kind="normalization"] { --kind: #94a3b8; }
[data-kind="embedding"] { --kind: #818cf8; }
[data-kind="position"] { --kind: #34d399; }
[data-kind="pooler"] { --kind: #c084fc; }
[data-kind="model"] { --kind: #fbbf24; }
[data-kind="lm_head"] { --kind: #ef4444; }
[data-kind] .kind-bar, [data-kind] .kind-dot { fill: var(--kind, var(--text-faint)); }
/* Repeat "deck": stacked cards behind the block (depth = layers). Cards with a
schedule get an inline pattern colour; the rest fall back to this neutral. */
.deck-card { stroke: none; opacity: 0.92; } /* scheduled cards keep their inline fill */
.deck-card.neutral { fill: var(--node-border); }
.node-repeat .node-box { stroke: var(--accent-strong); }
.node-repeat.selected .node-box { stroke-width: 2; }
/* Pseudo endpoints (input:* / state:*) */
.node-pseudo rect { fill: var(--panel-2); stroke: var(--border-strong); stroke-dasharray: 4 3; stroke-width: 1; }
.node-pseudo .node-title { font-size: 11px; fill: var(--text-muted); font-weight: 550; }
.node-pseudo-state rect { stroke: #06b6d4; }
.node-pseudo-state .node-title { fill: #22d3ee; }
/* Group containers */
.group { cursor: grab; }
.group-box { fill: var(--group-bg); stroke: var(--border); stroke-width: 1.25; }
.group-header { fill: var(--group-header-bg); }
.group-title { font-size: 12px; font-weight: 600; fill: var(--text-muted); pointer-events: none; }
/* Opaque (not accent-soft) so the schedule deck behind only peeks at the edges
instead of bleeding through the whole expanded block. */
.group-repeat .group-box { fill: color-mix(in srgb, var(--accent) 7%, var(--bg)); stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 7 4; }
.group-repeat .group-header { fill: var(--accent-soft); }
.group-repeat .group-title { fill: var(--accent-strong); }
.group.selected .group-box { stroke: var(--accent-strong); stroke-width: 2; }
/* Collapse / expand toggle on repeat blocks */
.toggle { cursor: pointer; }
.toggle circle { fill: var(--panel); stroke: var(--accent-strong); stroke-width: 1.25; }
.toggle:hover circle { fill: var(--accent-soft); }
.toggle-icon { stroke: var(--accent-strong); stroke-width: 1.75; stroke-linecap: round; fill: none; }
/* "tied" badge on the word embedding (weights shared with the LM head) */
.tied-badge rect { fill: color-mix(in srgb, #a78bfa 22%, var(--node-bg)); stroke: #a78bfa; stroke-width: 1.25; }
.tied-badge .attn-tag-txt { fill: #c4b5fd; }
/* Tensor-parallel shard-direction glyph on projection nodes */
.tp-glyph rect { fill: var(--accent-strong); opacity: 0.9; }
.tp-glyph.tp-rowwise rect { fill: #38bdf8; }
.kernel-bolt { color: #fbbf24; }
.sched-strip-label { font-size: 9.5px; fill: var(--text-muted); pointer-events: none; }
/* Org avatars on kernel badges (graph) */
.org-avatar { cursor: pointer; }
.org-avatar-ring { fill: none; stroke: #f59e0b; stroke-width: 1.5; }
/* Fallback kernel bolt (no avatar yet): yellow-bordered chip */
.kernel-bolt-badge { cursor: pointer; }
.kernel-bolt-badge circle { fill: var(--node-bg); stroke: #f59e0b; stroke-width: 1.25; }
.kernel-bolt-badge text { font-size: 11px; fill: #fbbf24; pointer-events: none; }
/* Org avatars in the inspector Hub-kernel section */
.org-avatars { display: flex; flex-wrap: wrap; gap: 6px; }
.org-avatar-chip { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-size: 11.5px; color: var(--text-muted); }
.org-avatar-chip img { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border); }
.org-avatar-chip:hover { color: var(--text); }
/* Attention-backend tags (on the attention node) */
.attn-tag rect { fill: var(--panel-2); stroke: var(--border-strong); stroke-width: 1; }
.attn-tag-txt { font-size: 10px; font-family: var(--mono); fill: var(--text-muted); pointer-events: none; }
.attn-tag.flash rect { fill: var(--panel-2); stroke: #f59e0b; stroke-width: 1.5; }
.attn-tag.flash .attn-tag-txt { fill: #fbbf24; }
.attn-tag.muted .attn-tag-txt { fill: var(--text-faint); }
/* Edges (drawn on top of nodes; stroke colours come from JS). The layer is
non-interactive so nodes underneath remain clickable. */
.layer-edges { pointer-events: none; }
.edge { transition: opacity .12s ease; }
.edge-line { stroke-width: 1.75; fill: none; transition: stroke-width .12s ease; }
.edge-halo { stroke: var(--bg); stroke-width: 4; fill: none; opacity: 0.9; }
.edge.edge-dim { opacity: 0.12; }
.edge.edge-hi .edge-line { stroke-width: 2.75; }
.edge.edge-observed { opacity: 0.85; }
/* --- Inspector --- */
.inspector-body { font-size: 13px; }
.insp-empty { color: var(--text-faint); font-size: 13px; padding: 8px 0; }
.insp-title { margin-bottom: 14px; }
.insp-label { font-size: 15px; font-weight: 650; }
.insp-id { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; word-break: break-all; }
.insp-section { padding: 12px 0; border-top: 1px solid var(--border); }
.insp-h { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin-bottom: 8px; font-weight: 600; }
.insp-row { display: grid; grid-template-columns: 116px 1fr; gap: 8px; padding: 3px 0; }
.insp-key { color: var(--text-muted); font-size: 12px; }
.insp-val { color: var(--text); word-break: break-word; }
.insp-val.mono, .mono { font-family: var(--mono); font-size: 11.5px; }
.edge-group-h { font-size: 11px; color: var(--text-faint); margin: 8px 0 4px; font-weight: 600; }
.edge-item {
display: flex; align-items: center; gap: 7px; padding: 5px 6px; border-radius: 7px;
cursor: pointer; font-size: 12px;
}
.edge-item:hover { background: var(--panel-2); }
.edge-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.edge-dir { color: var(--text-faint); font-family: var(--mono); }
.edge-name { flex: 1 1 auto; font-weight: 550; }
.edge-kind { color: var(--text-faint); font-size: 10.5px; font-family: var(--mono); }
/* --- Comparison view --- */
.btn.active { background: var(--accent-strong); color: var(--accent-ink); border-color: var(--accent-strong); }
.btn:disabled { opacity: 0.45; cursor: default; }
.compare-view { position: absolute; inset: 0; background: var(--bg); overflow-y: auto; display: none; }
body.compare .compare-view { display: block; }
/* Hide only the MAIN canvas graph — the compare panels also use .graph. */
body.compare #graph, body.compare .hint, body.compare .status { display: none; }
.cmp-bar {
position: sticky; top: 0; z-index: 2;
display: flex; align-items: center; gap: 12px;
padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.cmp-bar .select { width: auto; min-width: 160px; }
.cmp-a-label { font-weight: 650; font-size: 14px; color: var(--text); }
.cmp-vs { color: var(--text-faint); font-size: 13px; }
.cmp-bar .btn { margin-left: auto; }
.cmp-shared-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); }
.cmp-shared-dot { width: 10px; height: 10px; border-radius: 3px; border: 2px solid #34d399; box-sizing: border-box; }
/* Side-by-side graph panels */
.cmp-graphs { display: flex; height: 56vh; border-bottom: 1px solid var(--border); }
.cmp-pane { flex: 1 1 0; min-width: 0; position: relative; display: flex; flex-direction: column; }
.cmp-pane + .cmp-pane { border-left: 1px solid var(--border); }
.cmp-pane-h {
padding: 6px 12px; font-size: 12px; font-weight: 650; color: var(--text-muted);
background: var(--panel); border-bottom: 1px solid var(--border);
}
.cmp-pane .graph { flex: 1 1 auto; }
/* Shared components (present in both models, matched by stable id) */
.node.shared .node-box { stroke: #34d399; stroke-width: 2.25; }
.group.shared > .group-box { stroke: #34d399; stroke-width: 2; stroke-dasharray: none; }
.node.shared .kind-dot { fill: #34d399; }
/* Merged-diff view: single union graph, only-in-A blue, only-in-B red */
.cmp-pane-merged { display: none; }
body.cmp-merged .cmp-pane:not(.cmp-pane-merged) { display: none; }
body.cmp-merged .cmp-pane-merged { display: flex; flex: 1 1 0; }
.cmp-merge-legend { font-size: 12px; display: inline-flex; gap: 12px; }
.cmp-merge-legend .mrg-both { color: var(--text-muted); }
.cmp-merge-legend .mrg-a { color: #38bdf8; font-weight: 600; }
.cmp-merge-legend .mrg-b { color: #f87171; font-weight: 600; }
.node.origin-a .node-box { stroke: #38bdf8; stroke-width: 2.25; }
.node.origin-b .node-box { stroke: #f87171; stroke-width: 2.25; }
.node.origin-a .node-box { fill: color-mix(in srgb, #38bdf8 10%, var(--node-bg)); }
.node.origin-b .node-box { fill: color-mix(in srgb, #f87171 10%, var(--node-bg)); }
.group.origin-a > .group-box { stroke: #38bdf8; stroke-width: 2; stroke-dasharray: none; }
.group.origin-b > .group-box { stroke: #f87171; stroke-width: 2; stroke-dasharray: none; }
.compare-body { padding: 20px; max-width: 920px; margin: 0 auto; }
.cmp-msg { color: var(--text-muted); padding: 20px; }
.cmp-msg.error { color: #ff9d94; }
.cmp-banner { margin-bottom: 18px; }
.cmp-title { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.cmp-regime { color: var(--text-muted); font-size: 12.5px; margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.cmp-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.regime-lineage { background: rgba(16,185,129,.16); color: #34d399; }
.regime-shared_ids { background: rgba(14,165,233,.16); color: #38bdf8; }
.regime-cross_lineage { background: var(--accent-soft); color: var(--accent-strong); }
.cmp-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px 12px; margin-bottom: 16px; }
.cmp-card h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin: 8px 0; font-weight: 600; }
.cmp-row { display: grid; grid-template-columns: 190px 1fr 1fr; gap: 12px; padding: 6px 8px; border-radius: 7px; font-size: 13px; align-items: baseline; }
.cmp-row.cmp-head { font-weight: 650; color: var(--text); border-bottom: 1px solid var(--border); border-radius: 0; }
.cmp-row.cmp-diff { background: color-mix(in srgb, var(--accent) 9%, transparent); box-shadow: inset 3px 0 0 var(--accent-strong); }
.cmp-k { color: var(--text-muted); }
.cmp-v { color: var(--text); word-break: break-word; }
.cmp-va { color: #cdd3e0; }
.cmp-vb { color: var(--text); }
.cmp-yes { color: #34d399; font-weight: 700; }
.cmp-no { color: var(--text-faint); }
.cmp-tag { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; margin-left: 8px; background: var(--panel-2); color: var(--text-muted); }
.cmp-tag.only-a, .cmp-tag.del { background: rgba(239,68,68,.16); color: #f87171; }
.cmp-tag.only-b, .cmp-tag.add { background: rgba(16,185,129,.16); color: #34d399; }
.cmp-deltas { margin-left: 8px; color: var(--accent-strong); font-size: 11.5px; font-family: var(--mono); }
.cmp-node { padding: 8px 10px; border-radius: 8px; margin: 6px 0; border: 1px solid var(--border); }
.cmp-node.cmp-changed { box-shadow: inset 3px 0 0 var(--accent-strong); }
.cmp-node.cmp-added { box-shadow: inset 3px 0 0 #34d399; }
.cmp-node.cmp-removed { box-shadow: inset 3px 0 0 #f87171; }
.cmp-node-h { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.cmp-attr { display: grid; grid-template-columns: 160px 1fr; gap: 10px; font-size: 12px; padding: 2px 0; color: var(--text); }
.cmp-attr-k { color: var(--text-muted); }
/* Responsive: collapse side panels on narrow screens. */
@media (max-width: 1100px) {
.layout { grid-template-columns: 240px 1fr; }
.inspector { display: none; }
}