ui-improvements (#2)
Browse files- improve styles and html (3b8a2f3568d1df173dcf551be02497d7064f8259)
- use viewBox instead width and height (b57bdb966f86f42fdab08a76bada403468002b80)
- src/index.html +108 -120
- src/memory.js +1 -4
- src/style.css +4 -0
src/index.html
CHANGED
|
@@ -12,16 +12,11 @@
|
|
| 12 |
<style>
|
| 13 |
#controls {
|
| 14 |
display: grid;
|
| 15 |
-
grid-template-columns:
|
| 16 |
-
gap:
|
| 17 |
-
|
| 18 |
-
max-width:
|
| 19 |
-
|
| 20 |
-
padding: 0 10px;
|
| 21 |
-
}
|
| 22 |
-
|
| 23 |
-
#controls .row {
|
| 24 |
-
display: contents;
|
| 25 |
}
|
| 26 |
|
| 27 |
#controls .cell {
|
|
@@ -40,6 +35,11 @@
|
|
| 40 |
align-items: center;
|
| 41 |
justify-content: space-between;
|
| 42 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
#controls label {
|
| 45 |
text-align: right;
|
|
@@ -56,12 +56,18 @@
|
|
| 56 |
}
|
| 57 |
|
| 58 |
#controls input[type="number"] {
|
|
|
|
| 59 |
width: 60px;
|
| 60 |
-
height:
|
|
|
|
|
|
|
| 61 |
}
|
| 62 |
|
| 63 |
#controls select {
|
| 64 |
width: 100%;
|
|
|
|
|
|
|
|
|
|
| 65 |
}
|
| 66 |
|
| 67 |
#controls .column {
|
|
@@ -133,123 +139,105 @@
|
|
| 133 |
|
| 134 |
<aside>We are extremely thankful to the whole <a href="https://distill.pub/">distill.pub</a> team for creating
|
| 135 |
the template on which we based this blog post.</aside>
|
| 136 |
-
|
| 137 |
-
<div id="graph" style="position: relative; width: 700px; height: 500px;"></div>
|
| 138 |
<div id="controls">
|
| 139 |
-
<div class="
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
</div>
|
| 151 |
-
<div class="
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
</
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
<input type="checkbox" id="seq_parallel" name="seq_parallel">
|
| 160 |
-
<span></span> <!-- Empty span to maintain grid alignment -->
|
| 161 |
-
</div>
|
| 162 |
</div>
|
| 163 |
-
<div class="
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
<input type="number" id="h_input" value="512" min="128" max="16384">
|
| 168 |
-
</div>
|
| 169 |
-
<div class="cell column-2">
|
| 170 |
-
<label for="recomputation">Recomputation:</label>
|
| 171 |
-
<select id="recomputation" name="recomputation">
|
| 172 |
-
<option value="none">None</option>
|
| 173 |
-
<option value="selective">Selective</option>
|
| 174 |
-
<option value="full">Full</option>
|
| 175 |
-
</select>
|
| 176 |
-
<span></span> <!-- Empty span to maintain grid alignment -->
|
| 177 |
-
|
| 178 |
-
</div>
|
| 179 |
</div>
|
| 180 |
-
<div class="
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
</
|
| 186 |
-
<
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
<option value="0">0</option>
|
| 190 |
-
<option value="1">1</option>
|
| 191 |
-
<option value="2">2</option>
|
| 192 |
-
<option value="3">3</option>
|
| 193 |
-
</select>
|
| 194 |
-
<span></span> <!-- Empty span to maintain grid alignment -->
|
| 195 |
-
</div>
|
| 196 |
</div>
|
| 197 |
-
<div class="
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
<input type="number" id="L_input" value="12" min="1" max="126">
|
| 202 |
-
</div>
|
| 203 |
-
<div class="cell column-2">
|
| 204 |
-
<label for="ff_activation">FF Activation:</label>
|
| 205 |
-
<select id="ff_activation" name="ff_activation">
|
| 206 |
-
<option value="relu">ReLU</option>
|
| 207 |
-
<option value="gelu">GELU</option>
|
| 208 |
-
<option value="swiglu">SwiGLU</option>
|
| 209 |
-
</select>
|
| 210 |
-
<span></span> <!-- Empty span to maintain grid alignment -->
|
| 211 |
-
</div>
|
| 212 |
</div>
|
| 213 |
-
<div class="
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
<input type="number" id="s_input" value="128" min="64" max="128000">
|
| 218 |
-
</div>
|
| 219 |
-
<div class="cell column-2">
|
| 220 |
-
<label for="presets">Presets:</label>
|
| 221 |
-
<select id="presets" name="presets">
|
| 222 |
-
<option value="Llama 3 Tiny">Llama 3 Tiny</option>
|
| 223 |
-
<option value="Llama 3 8B">Llama 3 8B</option>
|
| 224 |
-
<option value="Llama 3 70B">Llama 3 70B</option>
|
| 225 |
-
<option value="Llama 3 405B">Llama 3 405B</option>
|
| 226 |
-
</select>
|
| 227 |
-
<span></span> <!-- Empty span to maintain grid alignment -->
|
| 228 |
-
</div>
|
| 229 |
</div>
|
| 230 |
-
<div class="
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
<input type="number" id="v_input" value="30522" min="1000" max="100000">
|
| 235 |
-
</div>
|
| 236 |
-
<div class="cell column-2">
|
| 237 |
-
<label for="tp">Tensor Parallelism (t):</label>
|
| 238 |
-
<input type="range" id="tp" name="tp" min="1" max="16" value="8">
|
| 239 |
-
<input type="number" id="tp_input" value="8" min="1" max="16">
|
| 240 |
-
</div>
|
| 241 |
</div>
|
| 242 |
-
<div class="
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
<input type="number" id="k_input" value="8" min="1" max="16">
|
| 247 |
-
</div>
|
| 248 |
-
<div class="cell column-2">
|
| 249 |
-
<label for="dp">Data Parallelism (d):</label>
|
| 250 |
-
<input type="range" id="dp" name="dp" min="1" max="256" value="1">
|
| 251 |
-
<input type="number" id="dp_input" value="1" min="1" max="256">
|
| 252 |
-
</div>
|
| 253 |
</div>
|
| 254 |
</div>
|
| 255 |
|
|
|
|
| 12 |
<style>
|
| 13 |
#controls {
|
| 14 |
display: grid;
|
| 15 |
+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
| 16 |
+
column-gap: 10px;
|
| 17 |
+
margin-bottom: 20px;
|
| 18 |
+
max-width: 100%;
|
| 19 |
+
container-type: inline-size;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
}
|
| 21 |
|
| 22 |
#controls .cell {
|
|
|
|
| 35 |
align-items: center;
|
| 36 |
justify-content: space-between;
|
| 37 |
}
|
| 38 |
+
@container (max-width: 600px) {
|
| 39 |
+
#controls .column-2 {
|
| 40 |
+
order: 2;
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
|
| 44 |
#controls label {
|
| 45 |
text-align: right;
|
|
|
|
| 56 |
}
|
| 57 |
|
| 58 |
#controls input[type="number"] {
|
| 59 |
+
flex-shrink: 0;
|
| 60 |
width: 60px;
|
| 61 |
+
height: 24px;
|
| 62 |
+
border: 1px solid var(--distill-gray-light);
|
| 63 |
+
border-radius: 0.2rem;
|
| 64 |
}
|
| 65 |
|
| 66 |
#controls select {
|
| 67 |
width: 100%;
|
| 68 |
+
min-height: 28px;
|
| 69 |
+
border: 1px solid var(--distill-gray-light);
|
| 70 |
+
border-radius: 0.2rem;
|
| 71 |
}
|
| 72 |
|
| 73 |
#controls .column {
|
|
|
|
| 139 |
|
| 140 |
<aside>We are extremely thankful to the whole <a href="https://distill.pub/">distill.pub</a> team for creating
|
| 141 |
the template on which we based this blog post.</aside>
|
| 142 |
+
<div id="graph"></div>
|
|
|
|
| 143 |
<div id="controls">
|
| 144 |
+
<div class="cell column-1">
|
| 145 |
+
<label for="a">Attention Heads (a):</label>
|
| 146 |
+
<input type="range" id="a" name="a" min="1" max="128" value="8">
|
| 147 |
+
<input type="number" id="a_input" value="8" min="1" max="128">
|
| 148 |
+
</div>
|
| 149 |
+
<div class="cell column-2">
|
| 150 |
+
<label for="mixed">Mixed Precision:</label>
|
| 151 |
+
<input type="checkbox" id="mixed" name="mixed" checked>
|
| 152 |
+
<span></span> <!-- Empty span to maintain grid alignment -->
|
| 153 |
+
</div>
|
| 154 |
+
<div class="cell column-1">
|
| 155 |
+
<label for="b">Micro Batch Size (b):</label>
|
| 156 |
+
<input type="range" id="b" name="b" min="1" max="53248" value="32">
|
| 157 |
+
<input type="number" id="b_input" value="32" min="1" max="53248">
|
| 158 |
+
</div>
|
| 159 |
+
<div class="cell column-2">
|
| 160 |
+
<label for="seq_parallel">Sequence Parallelism:</label>
|
| 161 |
+
<input type="checkbox" id="seq_parallel" name="seq_parallel">
|
| 162 |
+
<span></span> <!-- Empty span to maintain grid alignment -->
|
| 163 |
+
</div>
|
| 164 |
+
<div class="cell column-1">
|
| 165 |
+
<label for="h">Hidden Dimension (h):</label>
|
| 166 |
+
<input type="range" id="h" name="h" min="1" max="16384" value="512">
|
| 167 |
+
<input type="number" id="h_input" value="512" min="128" max="16384">
|
| 168 |
+
</div>
|
| 169 |
+
<div class="cell column-2">
|
| 170 |
+
<label for="recomputation">Recomputation:</label>
|
| 171 |
+
<select id="recomputation" name="recomputation">
|
| 172 |
+
<option value="none">None</option>
|
| 173 |
+
<option value="selective">Selective</option>
|
| 174 |
+
<option value="full">Full</option>
|
| 175 |
+
</select>
|
| 176 |
+
<span></span> <!-- Empty span to maintain grid alignment -->
|
| 177 |
+
</div>
|
| 178 |
+
<div class="cell column-1">
|
| 179 |
+
<label for="h_ff">Feedforward Dimension (h_ff):</label>
|
| 180 |
+
<input type="range" id="h_ff" name="h_ff" min="1" max="65536" value="2048">
|
| 181 |
+
<input type="number" id="h_ff_input" value="2048" min="512" max="65536">
|
| 182 |
+
</div>
|
| 183 |
+
<div class="cell column-2">
|
| 184 |
+
<label for="zero">Zero:</label>
|
| 185 |
+
<select id="zero" name="zero">
|
| 186 |
+
<option value="0">0</option>
|
| 187 |
+
<option value="1">1</option>
|
| 188 |
+
<option value="2">2</option>
|
| 189 |
+
<option value="3">3</option>
|
| 190 |
+
</select>
|
| 191 |
+
<span></span> <!-- Empty span to maintain grid alignment -->
|
| 192 |
+
</div>
|
| 193 |
+
<div class="cell column-1">
|
| 194 |
+
<label for="L">Number of Layers (L):</label>
|
| 195 |
+
<input type="range" id="L" name="L" min="1" max="126" value="12">
|
| 196 |
+
<input type="number" id="L_input" value="12" min="1" max="126">
|
| 197 |
</div>
|
| 198 |
+
<div class="cell column-2">
|
| 199 |
+
<label for="ff_activation">FF Activation:</label>
|
| 200 |
+
<select id="ff_activation" name="ff_activation">
|
| 201 |
+
<option value="relu">ReLU</option>
|
| 202 |
+
<option value="gelu">GELU</option>
|
| 203 |
+
<option value="swiglu">SwiGLU</option>
|
| 204 |
+
</select>
|
| 205 |
+
<span></span> <!-- Empty span to maintain grid alignment -->
|
|
|
|
|
|
|
|
|
|
| 206 |
</div>
|
| 207 |
+
<div class="cell column-1">
|
| 208 |
+
<label for="s">Sequence Length (s):</label>
|
| 209 |
+
<input type="range" id="s" name="s" min="1" max="128000" value="128">
|
| 210 |
+
<input type="number" id="s_input" value="128" min="64" max="128000">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
</div>
|
| 212 |
+
<div class="cell column-2">
|
| 213 |
+
<label for="presets">Presets:</label>
|
| 214 |
+
<select id="presets" name="presets">
|
| 215 |
+
<option value="Llama 3 Tiny">Llama 3 Tiny</option>
|
| 216 |
+
<option value="Llama 3 8B">Llama 3 8B</option>
|
| 217 |
+
<option value="Llama 3 70B">Llama 3 70B</option>
|
| 218 |
+
<option value="Llama 3 405B">Llama 3 405B</option>
|
| 219 |
+
</select>
|
| 220 |
+
<span></span> <!-- Empty span to maintain grid alignment -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 221 |
</div>
|
| 222 |
+
<div class="cell column-1">
|
| 223 |
+
<label for="v">Vocabulary Size (v):</label>
|
| 224 |
+
<input type="range" id="v" name="v" min="1000" max="100000" value="30522">
|
| 225 |
+
<input type="number" id="v_input" value="30522" min="1000" max="100000">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
</div>
|
| 227 |
+
<div class="cell column-2">
|
| 228 |
+
<label for="tp">Tensor Parallelism (t):</label>
|
| 229 |
+
<input type="range" id="tp" name="tp" min="1" max="16" value="8">
|
| 230 |
+
<input type="number" id="tp_input" value="8" min="1" max="16">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
</div>
|
| 232 |
+
<div class="cell column-1">
|
| 233 |
+
<label for="k">Optimizer Parameters (k):</label>
|
| 234 |
+
<input type="range" id="k" name="k" min="1" max="16" value="8">
|
| 235 |
+
<input type="number" id="k_input" value="8" min="1" max="16">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
</div>
|
| 237 |
+
<div class="cell column-2">
|
| 238 |
+
<label for="dp">Data Parallelism (d):</label>
|
| 239 |
+
<input type="range" id="dp" name="dp" min="1" max="256" value="1">
|
| 240 |
+
<input type="number" id="dp_input" value="1" min="1" max="256">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
</div>
|
| 242 |
</div>
|
| 243 |
|
src/memory.js
CHANGED
|
@@ -195,8 +195,7 @@ export function updateGraph() {
|
|
| 195 |
|
| 196 |
const svg = d3.select("#graph").select("svg");
|
| 197 |
svg.selectAll("*").remove();
|
| 198 |
-
svg.attr("
|
| 199 |
-
.attr("height", height + legendHeight);
|
| 200 |
|
| 201 |
const treemap = d3.treemap()
|
| 202 |
.size([width, height])
|
|
@@ -456,8 +455,6 @@ export const init_memory_plot = function () {
|
|
| 456 |
if (graphContainer) {
|
| 457 |
const svg = d3.select("#graph")
|
| 458 |
.append("svg")
|
| 459 |
-
.attr("width", 960)
|
| 460 |
-
.attr("height", 500);
|
| 461 |
} else {
|
| 462 |
console.warn('Graph container not found');
|
| 463 |
}
|
|
|
|
| 195 |
|
| 196 |
const svg = d3.select("#graph").select("svg");
|
| 197 |
svg.selectAll("*").remove();
|
| 198 |
+
svg.attr("viewBox", [0, 0, width, height + legendHeight]);
|
|
|
|
| 199 |
|
| 200 |
const treemap = d3.treemap()
|
| 201 |
.size([width, height])
|
|
|
|
| 455 |
if (graphContainer) {
|
| 456 |
const svg = d3.select("#graph")
|
| 457 |
.append("svg")
|
|
|
|
|
|
|
| 458 |
} else {
|
| 459 |
console.warn('Graph container not found');
|
| 460 |
}
|
src/style.css
CHANGED
|
@@ -246,6 +246,10 @@ d-article aside {
|
|
| 246 |
margin-bottom: 1em;
|
| 247 |
}
|
| 248 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 249 |
@media (min-width: 768px) {
|
| 250 |
d-article aside {
|
| 251 |
margin-bottom: 0;
|
|
|
|
| 246 |
margin-bottom: 1em;
|
| 247 |
}
|
| 248 |
|
| 249 |
+
d-article img {
|
| 250 |
+
max-width: 100%;
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
@media (min-width: 768px) {
|
| 254 |
d-article aside {
|
| 255 |
margin-bottom: 0;
|