Upload index.html
Browse filesAdded a small QoL at the suggestion of AMOGUS
- index.html +58 -19
index.html
CHANGED
|
@@ -144,7 +144,7 @@
|
|
| 144 |
return Number.parseFloat((model_config["parameters"] * bpw / 8).toFixed(2))
|
| 145 |
}
|
| 146 |
|
| 147 |
-
async function calculateSizes(format) {
|
| 148 |
|
| 149 |
format = "gguf"
|
| 150 |
|
|
@@ -170,18 +170,6 @@
|
|
| 170 |
document.getElementById("resultcontext").innerText = (context_size / 2**30).toFixed(2)
|
| 171 |
const result_total_el = document.getElementById("resulttotal");
|
| 172 |
result_total_el.innerText = total_size.toFixed(2)
|
| 173 |
-
|
| 174 |
-
//const gpu = document.getElementById("gpusearch").value
|
| 175 |
-
// if (gpu !== "") {
|
| 176 |
-
// const vram = parseFloat(gpu.split("-")[1].replace("GB", "").trim())
|
| 177 |
-
// if (vram - total_size > 0.5) {
|
| 178 |
-
// result_total_el.style.backgroundColor = "#bef264"
|
| 179 |
-
// } else if (vram - total_size > 0) {
|
| 180 |
-
// result_total_el.style.backgroundColor = "#facc15"
|
| 181 |
-
// } else {
|
| 182 |
-
// result_total_el.style.backgroundColor = "#ef4444"
|
| 183 |
-
// }
|
| 184 |
-
// }
|
| 185 |
|
| 186 |
const allocated_vram = Number.parseInt(document.getElementById("maxvram").value);
|
| 187 |
const vram = allocated_vram
|
|
@@ -196,11 +184,15 @@
|
|
| 196 |
const layer_size = ((model_size / 2**30) / model_config["num_hidden_layers"])
|
| 197 |
const layer_size_el = document.getElementById("layersize");
|
| 198 |
layer_size_el.innerText = layer_size.toFixed(2)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
|
| 200 |
-
const layers_offload = Math.floor((allocated_vram -
|
| 201 |
|
| 202 |
const layers_offload_el = document.getElementById("layersoffload");
|
| 203 |
-
layers_offload_el.innerText = layers_offload > model_config["num_hidden_layers"] ? model_config["num_hidden_layers"] : Math.max(0, layers_offload)
|
| 204 |
|
| 205 |
} catch(e) {
|
| 206 |
alert(e);
|
|
@@ -211,7 +203,7 @@
|
|
| 211 |
<title>Can I split it? - GGUF VRAM Calculator</title>
|
| 212 |
</head>
|
| 213 |
<body class="p-8">
|
| 214 |
-
<div x-data="{ format: 'gguf' }" class="flex flex-col max-h-screen items-center mt-16 gap-10">
|
| 215 |
<div style="text-align: center;">
|
| 216 |
<h1 class="text-xl font-semibold leading-6 text-gray-900">
|
| 217 |
GGUF Model, Can I split it?
|
|
@@ -329,6 +321,53 @@
|
|
| 329 |
class="block w-full rounded-md border-0 p-3 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
|
| 330 |
/>
|
| 331 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 332 |
<!-- GGUF Options -->
|
| 333 |
<div x-show="format === 'gguf'" class="relative">
|
| 334 |
<div class="flex flex-row gap-4">
|
|
@@ -444,7 +483,7 @@
|
|
| 444 |
<button
|
| 445 |
type="button"
|
| 446 |
class="rounded-md bg-slate-800 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-slate-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
| 447 |
-
@click="calculateSizes(format)"
|
| 448 |
>
|
| 449 |
Submit
|
| 450 |
</button>
|
|
@@ -498,7 +537,7 @@
|
|
| 498 |
<label
|
| 499 |
class="absolute -top-2 left-2 inline-block bg-white px-1 text-xs font-medium text-gray-900"
|
| 500 |
>
|
| 501 |
-
Layers offloaded to GPU
|
| 502 |
</label>
|
| 503 |
<div
|
| 504 |
id="layersoffload"
|
|
@@ -512,7 +551,7 @@
|
|
| 512 |
src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"
|
| 513 |
></script>
|
| 514 |
<script defer>
|
| 515 |
-
calculateSizes("gguf")
|
| 516 |
</script>
|
| 517 |
</body>
|
| 518 |
</html>
|
|
|
|
| 144 |
return Number.parseFloat((model_config["parameters"] * bpw / 8).toFixed(2))
|
| 145 |
}
|
| 146 |
|
| 147 |
+
async function calculateSizes(format, context_loc) {
|
| 148 |
|
| 149 |
format = "gguf"
|
| 150 |
|
|
|
|
| 170 |
document.getElementById("resultcontext").innerText = (context_size / 2**30).toFixed(2)
|
| 171 |
const result_total_el = document.getElementById("resulttotal");
|
| 172 |
result_total_el.innerText = total_size.toFixed(2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
|
| 174 |
const allocated_vram = Number.parseInt(document.getElementById("maxvram").value);
|
| 175 |
const vram = allocated_vram
|
|
|
|
| 184 |
const layer_size = ((model_size / 2**30) / model_config["num_hidden_layers"])
|
| 185 |
const layer_size_el = document.getElementById("layersize");
|
| 186 |
layer_size_el.innerText = layer_size.toFixed(2)
|
| 187 |
+
|
| 188 |
+
const context_dealloc = context_loc === "vram" ? (context_size / 2**30) : 0;
|
| 189 |
+
|
| 190 |
+
console.log(context_loc)
|
| 191 |
|
| 192 |
+
const layers_offload = Math.floor((allocated_vram - context_dealloc) / layer_size)
|
| 193 |
|
| 194 |
const layers_offload_el = document.getElementById("layersoffload");
|
| 195 |
+
layers_offload_el.innerText = `${layers_offload > model_config["num_hidden_layers"] ? model_config["num_hidden_layers"] : Math.max(0, layers_offload)}/${model_config["num_hidden_layers"]}`
|
| 196 |
|
| 197 |
} catch(e) {
|
| 198 |
alert(e);
|
|
|
|
| 203 |
<title>Can I split it? - GGUF VRAM Calculator</title>
|
| 204 |
</head>
|
| 205 |
<body class="p-8">
|
| 206 |
+
<div x-data="{ format: 'gguf', context_loc: 'vram' }" class="flex flex-col max-h-screen items-center mt-16 gap-10">
|
| 207 |
<div style="text-align: center;">
|
| 208 |
<h1 class="text-xl font-semibold leading-6 text-gray-900">
|
| 209 |
GGUF Model, Can I split it?
|
|
|
|
| 321 |
class="block w-full rounded-md border-0 p-3 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
|
| 322 |
/>
|
| 323 |
</div>
|
| 324 |
+
|
| 325 |
+
<div class="relative">
|
| 326 |
+
<label
|
| 327 |
+
class="absolute -top-2 left-2 inline-block bg-white px-1 text-xs font-medium text-gray-900"
|
| 328 |
+
>Context offloaded to</label
|
| 329 |
+
>
|
| 330 |
+
<fieldset
|
| 331 |
+
x-model="context_loc"
|
| 332 |
+
class="block w-full rounded-md border-0 p-3 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
|
| 333 |
+
>
|
| 334 |
+
<legend class="sr-only">Context location</legend>
|
| 335 |
+
<div
|
| 336 |
+
class="space-y-4 sm:flex sm:items-center sm:space-x-10 sm:space-y-0"
|
| 337 |
+
>
|
| 338 |
+
<div class="flex items-center">
|
| 339 |
+
<input
|
| 340 |
+
id="context-vram"
|
| 341 |
+
name="context-allocation"
|
| 342 |
+
type="radio"
|
| 343 |
+
value="vram"
|
| 344 |
+
checked
|
| 345 |
+
class="h-4 w-4 border-gray-300 text-indigo-600 focus:ring-indigo-600"
|
| 346 |
+
/>
|
| 347 |
+
<label
|
| 348 |
+
for="context-vram"
|
| 349 |
+
class="ml-3 block text-sm font-medium leading-6 text-gray-900"
|
| 350 |
+
>VRAM</label
|
| 351 |
+
>
|
| 352 |
+
</div>
|
| 353 |
+
<div class="flex items-center">
|
| 354 |
+
<input
|
| 355 |
+
id="context-ram"
|
| 356 |
+
name="context-allocation"
|
| 357 |
+
type="radio"
|
| 358 |
+
value="ram"
|
| 359 |
+
class="h-4 w-4 border-gray-300 text-indigo-600 focus:ring-indigo-600"
|
| 360 |
+
/>
|
| 361 |
+
<label
|
| 362 |
+
for="context-ram"
|
| 363 |
+
class="ml-3 block text-sm font-medium leading-6 text-gray-900"
|
| 364 |
+
>RAM</label
|
| 365 |
+
>
|
| 366 |
+
</div>
|
| 367 |
+
</div>
|
| 368 |
+
</fieldset>
|
| 369 |
+
</div>
|
| 370 |
+
|
| 371 |
<!-- GGUF Options -->
|
| 372 |
<div x-show="format === 'gguf'" class="relative">
|
| 373 |
<div class="flex flex-row gap-4">
|
|
|
|
| 483 |
<button
|
| 484 |
type="button"
|
| 485 |
class="rounded-md bg-slate-800 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-slate-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
| 486 |
+
@click="calculateSizes(format, context_loc)"
|
| 487 |
>
|
| 488 |
Submit
|
| 489 |
</button>
|
|
|
|
| 537 |
<label
|
| 538 |
class="absolute -top-2 left-2 inline-block bg-white px-1 text-xs font-medium text-gray-900"
|
| 539 |
>
|
| 540 |
+
Layers offloaded to GPU (out of total)
|
| 541 |
</label>
|
| 542 |
<div
|
| 543 |
id="layersoffload"
|
|
|
|
| 551 |
src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"
|
| 552 |
></script>
|
| 553 |
<script defer>
|
| 554 |
+
calculateSizes("gguf", "vram")
|
| 555 |
</script>
|
| 556 |
</body>
|
| 557 |
</html>
|