Spaces:
Running
Running
Default to Mima 1.5 Pico Final + add @arac : tool mode toggle
Browse files- index.html +38 -15
index.html
CHANGED
|
@@ -236,7 +236,8 @@
|
|
| 236 |
</div>
|
| 237 |
<div class="controls">
|
| 238 |
<select id="modelSelect" title="Model Seçimi">
|
| 239 |
-
<option value="
|
|
|
|
| 240 |
<option value="mima1">Mima 1 Pico</option>
|
| 241 |
</select>
|
| 242 |
<button class="ghost" id="clearBtn" type="button">Temizle</button>
|
|
@@ -256,19 +257,22 @@
|
|
| 256 |
<label>Tekrar Cezası: <strong id="repVal">1.00</strong>
|
| 257 |
<input id="repRange" type="range" min="1.00" max="1.25" step="0.02" value="1.00" />
|
| 258 |
</label>
|
|
|
|
|
|
|
|
|
|
| 259 |
</div>
|
| 260 |
|
| 261 |
<div class="chat-area" id="chatArea">
|
| 262 |
<div class="empty-state" id="emptyState">
|
| 263 |
<h2>Tarayıcıdan Doğrudan Test Edin</h2>
|
| 264 |
<p>
|
| 265 |
-
Seçtiğiniz Mima Pico modeli (~
|
| 266 |
-
İlk mesajda model ağırlıkları önbelleğe indirilir.
|
| 267 |
</p>
|
| 268 |
<div class="examples">
|
|
|
|
|
|
|
| 269 |
<button class="chip" type="button" data-q="Türkiye'nin başkenti neresidir?">Türkiye'nin başkenti neresidir?</button>
|
| 270 |
-
<button class="chip" type="button" data-q="Su kaç derecede kaynar?">Su kaç derecede kaynar?</button>
|
| 271 |
-
<button class="chip" type="button" data-q="Defter ne işe yarar?">Defter ne işe yarar?</button>
|
| 272 |
<button class="chip" type="button" data-q="2099 yılında Mars'ta kurulan ilk Türk futbol takımının kalecisi kimdir?">2099 Mars futbol kalecisi?</button>
|
| 273 |
</div>
|
| 274 |
</div>
|
|
@@ -282,10 +286,10 @@
|
|
| 282 |
<div class="statusbar">
|
| 283 |
<span id="statusText">Hazır — ilk mesajda seçili model indirilir.</span>
|
| 284 |
<span>
|
| 285 |
-
|
| 286 |
-
<a href="https://huggingface.co/root-sys-n/Mima-1.5-Pico-15m-Preview" target="_blank" rel="noopener">Mima 1.5 Preview</a> ·
|
| 287 |
<a href="https://huggingface.co/root-sys-n/Mima-1-Pico-15m" target="_blank" rel="noopener">Mima 1</a> ·
|
| 288 |
-
|
|
|
|
| 289 |
</span>
|
| 290 |
</div>
|
| 291 |
</div>
|
|
@@ -300,10 +304,12 @@
|
|
| 300 |
|
| 301 |
const BOS = 0, USER = 1, ASST = 2, END = 3;
|
| 302 |
const N_LAYER = 7, N_HEAD = 6, HEAD_DIM = 64, BLOCK_SIZE = 512;
|
|
|
|
| 303 |
|
| 304 |
const MODELS = {
|
| 305 |
-
|
| 306 |
-
|
|
|
|
| 307 |
};
|
| 308 |
|
| 309 |
let tokenizer = null;
|
|
@@ -349,7 +355,7 @@
|
|
| 349 |
async function fetchModelBytes(url, label) {
|
| 350 |
try {
|
| 351 |
if ("caches" in window) {
|
| 352 |
-
const cache = await caches.open("mima-pico-onnx-
|
| 353 |
const hit = await cache.match(url);
|
| 354 |
if (hit) {
|
| 355 |
setProgress(`${label} önbellekten yükleniyor...`);
|
|
@@ -393,7 +399,7 @@
|
|
| 393 |
|
| 394 |
try {
|
| 395 |
if ("caches" in window) {
|
| 396 |
-
const cache = await caches.open("mima-pico-onnx-
|
| 397 |
await cache.put(url, new Response(merged, { headers: { "Content-Type": "application/octet-stream" } }));
|
| 398 |
}
|
| 399 |
} catch (_) {}
|
|
@@ -539,7 +545,9 @@
|
|
| 539 |
const maxNew = Number(maxTokRange.value);
|
| 540 |
const repPen = Number(repRange.value);
|
| 541 |
|
| 542 |
-
const
|
|
|
|
|
|
|
| 543 |
const allTokens = promptIds.slice();
|
| 544 |
const generated = [];
|
| 545 |
|
|
@@ -589,9 +597,24 @@
|
|
| 589 |
await new Promise((r) => setTimeout(r, 0));
|
| 590 |
}
|
| 591 |
|
| 592 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 593 |
botUi.bubble.textContent = finalText;
|
| 594 |
-
history.push({ u:
|
| 595 |
const sec = Math.max(0.01, (performance.now() - t0) / 1000);
|
| 596 |
const tps = (generated.length / sec).toFixed(1);
|
| 597 |
statusText.textContent = `Tamamlandı · ${generated.length} token · ${tps} tok/s`;
|
|
|
|
| 236 |
</div>
|
| 237 |
<div class="controls">
|
| 238 |
<select id="modelSelect" title="Model Seçimi">
|
| 239 |
+
<option value="mima15full" selected>Mima 1.5 Pico (Final)</option>
|
| 240 |
+
<option value="mima15">Mima 1.5 Pico Preview</option>
|
| 241 |
<option value="mima1">Mima 1 Pico</option>
|
| 242 |
</select>
|
| 243 |
<button class="ghost" id="clearBtn" type="button">Temizle</button>
|
|
|
|
| 257 |
<label>Tekrar Cezası: <strong id="repVal">1.00</strong>
|
| 258 |
<input id="repRange" type="range" min="1.00" max="1.25" step="0.02" value="1.00" />
|
| 259 |
</label>
|
| 260 |
+
<label title="Mima 1.5 Pico'nun 7 araçlı @arac: protokolünü etkinleştirir">
|
| 261 |
+
<input id="toolModeCheck" type="checkbox" /> Araç Modu (@arac)
|
| 262 |
+
</label>
|
| 263 |
</div>
|
| 264 |
|
| 265 |
<div class="chat-area" id="chatArea">
|
| 266 |
<div class="empty-state" id="emptyState">
|
| 267 |
<h2>Tarayıcıdan Doğrudan Test Edin</h2>
|
| 268 |
<p>
|
| 269 |
+
Seçtiğiniz Mima Pico modeli (Mima 1.5 Final sadece ~37.5 MB FP16-ONNX) sunucuya ihtiyaç duymadan doğrudan tarayıcınızda çalıştırılır.
|
| 270 |
+
İlk mesajda model ağırlıkları önbelleğe indirilir. Çok turlu sohbet ve araç modu desteklenir.
|
| 271 |
</p>
|
| 272 |
<div class="examples">
|
| 273 |
+
<button class="chip" type="button" data-q="Adın ne senin?">Adın ne senin?</button>
|
| 274 |
+
<button class="chip" type="button" data-q="Güneş Sistemi'nde kaç gezegen var?">Güneş Sistemi'nde kaç gezegen var?</button>
|
| 275 |
<button class="chip" type="button" data-q="Türkiye'nin başkenti neresidir?">Türkiye'nin başkenti neresidir?</button>
|
|
|
|
|
|
|
| 276 |
<button class="chip" type="button" data-q="2099 yılında Mars'ta kurulan ilk Türk futbol takımının kalecisi kimdir?">2099 Mars futbol kalecisi?</button>
|
| 277 |
</div>
|
| 278 |
</div>
|
|
|
|
| 286 |
<div class="statusbar">
|
| 287 |
<span id="statusText">Hazır — ilk mesajda seçili model indirilir.</span>
|
| 288 |
<span>
|
| 289 |
+
<a href="https://huggingface.co/root-sys-n/Mima-1.5-Pico-15m" target="_blank" rel="noopener">Mima 1.5 Pico</a> ·
|
|
|
|
| 290 |
<a href="https://huggingface.co/root-sys-n/Mima-1-Pico-15m" target="_blank" rel="noopener">Mima 1</a> ·
|
| 291 |
+
<a href="https://huggingface.co/datasets/root-sys-n/Mima-TR-SFT-30K" target="_blank" rel="noopener">SFT-30K</a> ·
|
| 292 |
+
<a href="https://huggingface.co/datasets/root-sys-n/Mima-TR-MicroBench" target="_blank" rel="noopener">MicroBench</a>
|
| 293 |
</span>
|
| 294 |
</div>
|
| 295 |
</div>
|
|
|
|
| 304 |
|
| 305 |
const BOS = 0, USER = 1, ASST = 2, END = 3;
|
| 306 |
const N_LAYER = 7, N_HEAD = 6, HEAD_DIM = 64, BLOCK_SIZE = 512;
|
| 307 |
+
const TOOLS_PREFIX = "[Araçlar: hesapla(ifade), hava(sehir), web_ara(sorgu), saat(sehir), kur(miktar, kaynak, hedef), not_ekle(baslik), cevir(metin, dil)]\n";
|
| 308 |
|
| 309 |
const MODELS = {
|
| 310 |
+
mima15full: { label: "Mima 1.5 Pico (Final)", url: "./mima_1_5_pico.onnx" },
|
| 311 |
+
mima15: { label: "Mima 1.5 Pico Preview", url: "./mima_1_5_preview.onnx" },
|
| 312 |
+
mima1: { label: "Mima 1 Pico", url: "./mima_1.onnx" },
|
| 313 |
};
|
| 314 |
|
| 315 |
let tokenizer = null;
|
|
|
|
| 355 |
async function fetchModelBytes(url, label) {
|
| 356 |
try {
|
| 357 |
if ("caches" in window) {
|
| 358 |
+
const cache = await caches.open("mima-pico-onnx-v2");
|
| 359 |
const hit = await cache.match(url);
|
| 360 |
if (hit) {
|
| 361 |
setProgress(`${label} önbellekten yükleniyor...`);
|
|
|
|
| 399 |
|
| 400 |
try {
|
| 401 |
if ("caches" in window) {
|
| 402 |
+
const cache = await caches.open("mima-pico-onnx-v2");
|
| 403 |
await cache.put(url, new Response(merged, { headers: { "Content-Type": "application/octet-stream" } }));
|
| 404 |
}
|
| 405 |
} catch (_) {}
|
|
|
|
| 545 |
const maxNew = Number(maxTokRange.value);
|
| 546 |
const repPen = Number(repRange.value);
|
| 547 |
|
| 548 |
+
const useTools = document.getElementById("toolModeCheck")?.checked && modelKey === "mima15full";
|
| 549 |
+
const effectiveMsg = useTools ? (TOOLS_PREFIX + msg) : msg;
|
| 550 |
+
const promptIds = buildPromptIds(tok, history, effectiveMsg, maxNew);
|
| 551 |
const allTokens = promptIds.slice();
|
| 552 |
const generated = [];
|
| 553 |
|
|
|
|
| 597 |
await new Promise((r) => setTimeout(r, 0));
|
| 598 |
}
|
| 599 |
|
| 600 |
+
let finalText = tok.decode(generated).trim() || "(boş yanıt)";
|
| 601 |
+
if (useTools && finalText.startsWith("@arac:")) {
|
| 602 |
+
const mCalc = finalText.match(/^@arac:\s*hesapla\s*\|\s*ifade\s*=\s*([0-9+\-*/().\s]+)$/);
|
| 603 |
+
const mClock = finalText.match(/^@arac:\s*saat\s*\|/);
|
| 604 |
+
const mNote = finalText.match(/^@arac:\s*not_ekle\s*\|\s*baslik\s*=\s*(.+)$/);
|
| 605 |
+
if (mCalc) {
|
| 606 |
+
try {
|
| 607 |
+
const val = Function('"use strict";return (' + mCalc[1] + ')')();
|
| 608 |
+
finalText += `\n[Yerel Hesaplayıcı → ${val}]`;
|
| 609 |
+
} catch (_) {}
|
| 610 |
+
} else if (mClock) {
|
| 611 |
+
finalText += `\n[Yerel Saat → ${new Date().toLocaleTimeString("tr-TR", { hour: "2-digit", minute: "2-digit" })}]`;
|
| 612 |
+
} else if (mNote) {
|
| 613 |
+
finalText += `\n[Not Kaydedildi → "${mNote[1].trim()}"]`;
|
| 614 |
+
}
|
| 615 |
+
}
|
| 616 |
botUi.bubble.textContent = finalText;
|
| 617 |
+
history.push({ u: effectiveMsg, a: finalText });
|
| 618 |
const sec = Math.max(0.01, (performance.now() - t0) / 1000);
|
| 619 |
const tps = (generated.length / sec).toFixed(1);
|
| 620 |
statusText.textContent = `Tamamlandı · ${generated.length} token · ${tps} tok/s`;
|