Spaces:
Running
Running
Update index.html
Browse files- index.html +79 -40
index.html
CHANGED
|
@@ -38,10 +38,10 @@
|
|
| 38 |
import snarkdown from "https://cdn.skypack.dev/snarkdown";
|
| 39 |
import hljs from "https://cdn.skypack.dev/highlight.js";
|
| 40 |
// models base url
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
model: "model-q4k.gguf",
|
| 46 |
tokenizer: "tokenizer.json",
|
| 47 |
config: "phi-1_5.json",
|
|
@@ -49,9 +49,9 @@
|
|
| 49 |
seq_len: 2048,
|
| 50 |
size: "800 MB",
|
| 51 |
},
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
model: "model-q80.gguf",
|
| 56 |
tokenizer: "tokenizer.json",
|
| 57 |
config: "phi-1_5.json",
|
|
@@ -59,19 +59,23 @@
|
|
| 59 |
seq_len: 2048,
|
| 60 |
size: "1.51 GB",
|
| 61 |
},
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
model: [
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
tokenizer: "tokenizer.json",
|
| 67 |
config: "config.json",
|
| 68 |
quantized: true,
|
| 69 |
seq_len: 2048,
|
| 70 |
size: "1.57GB",
|
| 71 |
},
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
model: "model-puffin-phi-v2-q4k.gguf",
|
| 76 |
tokenizer: "tokenizer-puffin-phi-v2.json",
|
| 77 |
config: "puffin-phi-v2.json",
|
|
@@ -79,9 +83,9 @@
|
|
| 79 |
seq_len: 2048,
|
| 80 |
size: "798 MB",
|
| 81 |
},
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
model: "model-puffin-phi-v2-q80.gguf",
|
| 86 |
tokenizer: "tokenizer-puffin-phi-v2.json",
|
| 87 |
config: "puffin-phi-v2.json",
|
|
@@ -158,7 +162,10 @@ Very polite review:`,
|
|
| 158 |
const getValue = (id) => document.querySelector(`#${id}`).value;
|
| 159 |
const modelID = getValue("model");
|
| 160 |
const model = MODELS[modelID];
|
| 161 |
-
const weightsURL =
|
|
|
|
|
|
|
|
|
|
| 162 |
const tokenizerURL = model.base_url + model.tokenizer;
|
| 163 |
const configURL = model.base_url + model.config;
|
| 164 |
|
|
@@ -259,9 +266,9 @@ Very polite review:`,
|
|
| 259 |
const query = new URLSearchParams(window.location.search);
|
| 260 |
const modelID = query.get("model");
|
| 261 |
if (modelID) {
|
| 262 |
-
|
| 263 |
} else {
|
| 264 |
-
|
| 265 |
}
|
| 266 |
|
| 267 |
for (const [i, { title, prompt }] of TEMPLATES.entries()) {
|
|
@@ -287,16 +294,18 @@ Very polite review:`,
|
|
| 287 |
prompt.value = template;
|
| 288 |
prompt.style.height = "auto";
|
| 289 |
prompt.style.height = prompt.scrollHeight + "px";
|
|
|
|
|
|
|
| 290 |
});
|
| 291 |
modelSelect.addEventListener("change", (e) => {
|
| 292 |
const query = new URLSearchParams(window.location.search);
|
| 293 |
query.set("model", e.target.value);
|
| 294 |
window.history.replaceState(
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
);
|
| 299 |
-
window.parent.postMessage({queryString: "?" + query }, "*")
|
| 300 |
const model = MODELS[e.target.value];
|
| 301 |
document.querySelector("#max-seq").max = model.seq_len;
|
| 302 |
document.querySelector("#max-seq").nextElementSibling.value = 200;
|
|
@@ -345,24 +354,49 @@ Very polite review:`,
|
|
| 345 |
<main class="grid grid-cols-1 gap-8 relative">
|
| 346 |
<span class="absolute text-5xl -ml-[1em]"> 🕯️ </span>
|
| 347 |
<div>
|
| 348 |
-
<h1 class="text-5xl font-bold">Candle Phi 1.5 / Phi 2.0
|
| 349 |
<h2 class="text-2xl font-bold">Rust/WASM Demo</h2>
|
| 350 |
<p class="max-w-lg">
|
| 351 |
The
|
| 352 |
-
<a
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
</p>
|
| 360 |
<p class="max-w-lg">
|
| 361 |
You can also try
|
| 362 |
-
<a
|
|
|
|
|
|
|
|
|
|
|
|
|
| 363 |
</a>
|
| 364 |
quantized version, a fine-tuned version of Phi-1.5 on the
|
| 365 |
-
<a
|
|
|
|
|
|
|
|
|
|
|
|
|
| 366 |
</a>
|
| 367 |
</p>
|
| 368 |
</div>
|
|
@@ -370,7 +404,7 @@ Very polite review:`,
|
|
| 370 |
<p class="text-xs italic max-w-lg">
|
| 371 |
<b>Note:</b>
|
| 372 |
When first run, the app will download and cache the model, which could
|
| 373 |
-
take a few minutes. The models are <b>~800MB</b> or <b>~1.
|
| 374 |
size.
|
| 375 |
</p>
|
| 376 |
</div>
|
|
@@ -382,8 +416,13 @@ Very polite review:`,
|
|
| 382 |
></select>
|
| 383 |
</div>
|
| 384 |
<div>
|
| 385 |
-
<
|
| 386 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
</div>
|
| 388 |
<form
|
| 389 |
id="form"
|
|
@@ -393,7 +432,7 @@ Very polite review:`,
|
|
| 393 |
<textarea
|
| 394 |
type="text"
|
| 395 |
id="prompt"
|
| 396 |
-
class="font-light w-full px-3 py-2 mx-1 resize-none outline-none"
|
| 397 |
oninput="this.style.height = 0;this.style.height = this.scrollHeight + 'px'"
|
| 398 |
placeholder="Add your prompt here..."
|
| 399 |
>
|
|
@@ -524,9 +563,9 @@ Output:</textarea
|
|
| 524 |
<div
|
| 525 |
id="output-counter"
|
| 526 |
hidden
|
| 527 |
-
class="ml-auto font-semibold grid-rows-1
|
| 528 |
></div>
|
| 529 |
-
<p hidden id="output-generation" class="grid-rows-2"></p>
|
| 530 |
<span id="output-status" class="m-auto font-light"
|
| 531 |
>No output yet</span
|
| 532 |
>
|
|
|
|
| 38 |
import snarkdown from "https://cdn.skypack.dev/snarkdown";
|
| 39 |
import hljs from "https://cdn.skypack.dev/highlight.js";
|
| 40 |
// models base url
|
| 41 |
+
const MODELS = {
|
| 42 |
+
phi_1_5_q4k: {
|
| 43 |
+
base_url:
|
| 44 |
+
"https://huggingface.co/lmz/candle-quantized-phi/resolve/main/",
|
| 45 |
model: "model-q4k.gguf",
|
| 46 |
tokenizer: "tokenizer.json",
|
| 47 |
config: "phi-1_5.json",
|
|
|
|
| 49 |
seq_len: 2048,
|
| 50 |
size: "800 MB",
|
| 51 |
},
|
| 52 |
+
phi_1_5_q80: {
|
| 53 |
+
base_url:
|
| 54 |
+
"https://huggingface.co/lmz/candle-quantized-phi/resolve/main/",
|
| 55 |
model: "model-q80.gguf",
|
| 56 |
tokenizer: "tokenizer.json",
|
| 57 |
config: "phi-1_5.json",
|
|
|
|
| 59 |
seq_len: 2048,
|
| 60 |
size: "1.51 GB",
|
| 61 |
},
|
| 62 |
+
phi_2_0_q4k: {
|
| 63 |
+
base_url:
|
| 64 |
+
"https://huggingface.co/radames/phi-2-quantized/resolve/main/",
|
| 65 |
+
model: [
|
| 66 |
+
"model-v2-q4k.gguf_aa.part",
|
| 67 |
+
"model-v2-q4k.gguf_ab.part",
|
| 68 |
+
"model-v2-q4k.gguf_ac.part",
|
| 69 |
+
],
|
| 70 |
tokenizer: "tokenizer.json",
|
| 71 |
config: "config.json",
|
| 72 |
quantized: true,
|
| 73 |
seq_len: 2048,
|
| 74 |
size: "1.57GB",
|
| 75 |
},
|
| 76 |
+
puffin_phi_v2_q4k: {
|
| 77 |
+
base_url:
|
| 78 |
+
"https://huggingface.co/lmz/candle-quantized-phi/resolve/main/",
|
| 79 |
model: "model-puffin-phi-v2-q4k.gguf",
|
| 80 |
tokenizer: "tokenizer-puffin-phi-v2.json",
|
| 81 |
config: "puffin-phi-v2.json",
|
|
|
|
| 83 |
seq_len: 2048,
|
| 84 |
size: "798 MB",
|
| 85 |
},
|
| 86 |
+
puffin_phi_v2_q80: {
|
| 87 |
+
base_url:
|
| 88 |
+
"https://huggingface.co/lmz/candle-quantized-phi/resolve/main/",
|
| 89 |
model: "model-puffin-phi-v2-q80.gguf",
|
| 90 |
tokenizer: "tokenizer-puffin-phi-v2.json",
|
| 91 |
config: "puffin-phi-v2.json",
|
|
|
|
| 162 |
const getValue = (id) => document.querySelector(`#${id}`).value;
|
| 163 |
const modelID = getValue("model");
|
| 164 |
const model = MODELS[modelID];
|
| 165 |
+
const weightsURL =
|
| 166 |
+
model.model instanceof Array
|
| 167 |
+
? model.model.map((m) => model.base_url + m)
|
| 168 |
+
: model.base_url + model.model;
|
| 169 |
const tokenizerURL = model.base_url + model.tokenizer;
|
| 170 |
const configURL = model.base_url + model.config;
|
| 171 |
|
|
|
|
| 266 |
const query = new URLSearchParams(window.location.search);
|
| 267 |
const modelID = query.get("model");
|
| 268 |
if (modelID) {
|
| 269 |
+
modelSelect.value = modelID;
|
| 270 |
} else {
|
| 271 |
+
modelSelect.value = "phi_1_5_q4k";
|
| 272 |
}
|
| 273 |
|
| 274 |
for (const [i, { title, prompt }] of TEMPLATES.entries()) {
|
|
|
|
| 294 |
prompt.value = template;
|
| 295 |
prompt.style.height = "auto";
|
| 296 |
prompt.style.height = prompt.scrollHeight + "px";
|
| 297 |
+
runBtn.disabled = false;
|
| 298 |
+
clearBtn.classList.remove("invisible");
|
| 299 |
});
|
| 300 |
modelSelect.addEventListener("change", (e) => {
|
| 301 |
const query = new URLSearchParams(window.location.search);
|
| 302 |
query.set("model", e.target.value);
|
| 303 |
window.history.replaceState(
|
| 304 |
+
{},
|
| 305 |
+
"",
|
| 306 |
+
`${window.location.pathname}?${query}`
|
| 307 |
);
|
| 308 |
+
window.parent.postMessage({ queryString: "?" + query }, "*");
|
| 309 |
const model = MODELS[e.target.value];
|
| 310 |
document.querySelector("#max-seq").max = model.seq_len;
|
| 311 |
document.querySelector("#max-seq").nextElementSibling.value = 200;
|
|
|
|
| 354 |
<main class="grid grid-cols-1 gap-8 relative">
|
| 355 |
<span class="absolute text-5xl -ml-[1em]"> 🕯️ </span>
|
| 356 |
<div>
|
| 357 |
+
<h1 class="text-5xl font-bold">Candle Phi 1.5 / Phi 2.0</h1>
|
| 358 |
<h2 class="text-2xl font-bold">Rust/WASM Demo</h2>
|
| 359 |
<p class="max-w-lg">
|
| 360 |
The
|
| 361 |
+
<a
|
| 362 |
+
href="https://huggingface.co/microsoft/phi-1_5"
|
| 363 |
+
class="link"
|
| 364 |
+
target="_blank"
|
| 365 |
+
>Phi-1.5</a
|
| 366 |
+
>
|
| 367 |
+
and
|
| 368 |
+
<a
|
| 369 |
+
href="https://huggingface.co/microsoft/phi-2"
|
| 370 |
+
class="link"
|
| 371 |
+
target="_blank"
|
| 372 |
+
>Phi-2</a
|
| 373 |
+
>
|
| 374 |
+
models achieve state-of-the-art performance with only 1.3 billion and
|
| 375 |
+
2.7 billion parameters, compared to larger models with up to 13
|
| 376 |
+
billion parameters. Here you can try the quantized versions.
|
| 377 |
+
Additional prompt examples are available in the
|
| 378 |
+
<a
|
| 379 |
+
href="https://arxiv.org/pdf/2309.05463.pdf#page=8"
|
| 380 |
+
class="link"
|
| 381 |
+
target="_blank"
|
| 382 |
+
>
|
| 383 |
+
technical report </a
|
| 384 |
+
>.
|
| 385 |
</p>
|
| 386 |
<p class="max-w-lg">
|
| 387 |
You can also try
|
| 388 |
+
<a
|
| 389 |
+
href="https://huggingface.co/teknium/Puffin-Phi-v2"
|
| 390 |
+
class="link"
|
| 391 |
+
target="_blank"
|
| 392 |
+
>Puffin-Phi V2
|
| 393 |
</a>
|
| 394 |
quantized version, a fine-tuned version of Phi-1.5 on the
|
| 395 |
+
<a
|
| 396 |
+
href="https://huggingface.co/datasets/LDJnr/Puffin"
|
| 397 |
+
class="link"
|
| 398 |
+
target="_blank"
|
| 399 |
+
>Puffin dataset
|
| 400 |
</a>
|
| 401 |
</p>
|
| 402 |
</div>
|
|
|
|
| 404 |
<p class="text-xs italic max-w-lg">
|
| 405 |
<b>Note:</b>
|
| 406 |
When first run, the app will download and cache the model, which could
|
| 407 |
+
take a few minutes. The models are <b>~800MB</b> or <b>~1.57GB</b> in
|
| 408 |
size.
|
| 409 |
</p>
|
| 410 |
</div>
|
|
|
|
| 416 |
></select>
|
| 417 |
</div>
|
| 418 |
<div>
|
| 419 |
+
<details>
|
| 420 |
+
<summary class="font-medium cursor-pointer">Prompt Templates</summary>
|
| 421 |
+
<form
|
| 422 |
+
id="prompt-templates"
|
| 423 |
+
class="grid grid-cols-1 sm:grid-cols-2 gap-1 my-2"
|
| 424 |
+
></form>
|
| 425 |
+
</details>
|
| 426 |
</div>
|
| 427 |
<form
|
| 428 |
id="form"
|
|
|
|
| 432 |
<textarea
|
| 433 |
type="text"
|
| 434 |
id="prompt"
|
| 435 |
+
class="font-light text-lg w-full px-3 py-2 mx-1 resize-none outline-none"
|
| 436 |
oninput="this.style.height = 0;this.style.height = this.scrollHeight + 'px'"
|
| 437 |
placeholder="Add your prompt here..."
|
| 438 |
>
|
|
|
|
| 563 |
<div
|
| 564 |
id="output-counter"
|
| 565 |
hidden
|
| 566 |
+
class="ml-auto font-semibold grid-rows-1"
|
| 567 |
></div>
|
| 568 |
+
<p hidden id="output-generation" class="grid-rows-2 text-lg"></p>
|
| 569 |
<span id="output-status" class="m-auto font-light"
|
| 570 |
>No output yet</span
|
| 571 |
>
|