Spaces:
Running
Running
File size: 10,170 Bytes
99e14ba 391265d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>KoarAI LFM2.5 Training Studio</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
<style>
body { background-color: #0f172a; color: #f8fafc; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.card { background-color: #1e293b; border: 1px solid #334155; border-radius: 12px; }
.slider-accent { accent-color: #6366f1; }
pre { background-color: #090d16; border: 1px solid #1e293b; }
</style>
</head>
<body class="p-6 md:p-10">
<div class="max-w-6xl mx-auto">
<header class="mb-8 border-b border-gray-700 pb-6 flex items-center justify-between">
<div>
<h1 class="text-3xl font-extrabold text-indigo-400 flex items-center gap-2">
π§ KoarAI LFM2.5-350M Training Studio
</h1>
<p class="text-gray-400 mt-2">
Interactive Dataset Mixer, Reasoning (CoT) Balancer & Colab Pipeline Generator for <b>LiquidAI/LFM2.5-350M</b>.
</p>
</div>
<a href="https://huggingface.co/KoarAI/LFM2.5-350M-Thinking-0003" target="_blank" class="bg-indigo-600 hover:bg-indigo-500 text-white px-4 py-2 rounded-lg font-medium shadow-md transition">
View Model on HF π
</a>
</header>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<!-- Left Column: Controls -->
<div class="card p-6 shadow-xl">
<h2 class="text-xl font-bold mb-4 text-indigo-300">ποΈ 1. Dataset Mix Configuration</h2>
<div class="space-y-4">
<div>
<div class="flex justify-between text-sm mb-1">
<span class="font-medium text-gray-300">π·πΊ Russian Deep CoT (ZeroAgency/ru-thinking-reasoning-r1)</span>
<span id="val_ru_cot" class="font-bold text-indigo-400">700</span>
</div>
<input type="range" id="ru_cot" min="0" max="2000" step="50" value="700" class="w-full slider-accent" oninput="update()">
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="font-medium text-gray-300">π¬ Russian Natural Chat (Vikhrmodels/GrandMaster-PRO-MAX)</span>
<span id="val_ru_chat" class="font-bold text-indigo-400">700</span>
</div>
<input type="range" id="ru_chat" min="0" max="2000" step="50" value="700" class="w-full slider-accent" oninput="update()">
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="font-medium text-gray-300">π English General Chat (LDJnr/Capybara)</span>
<span id="val_en_chat" class="font-bold text-indigo-400">800</span>
</div>
<input type="range" id="en_chat" min="0" max="2000" step="50" value="800" class="w-full slider-accent" oninput="update()">
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="font-medium text-gray-300">π Math & Logic CoT (r0b0tlab/qwen3.8-max-distillation-50k)</span>
<span id="val_math_cot" class="font-bold text-indigo-400">600</span>
</div>
<input type="range" id="math_cot" min="0" max="2000" step="50" value="600" class="w-full slider-accent" oninput="update()">
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="font-medium text-gray-300">π» Clean Python & Code (iamtarun/python_code_instructions)</span>
<span id="val_code" class="font-bold text-indigo-400">350</span>
</div>
<input type="range" id="code" min="0" max="2000" step="50" value="350" class="w-full slider-accent" oninput="update()">
</div>
</div>
<h2 class="text-xl font-bold mt-8 mb-4 text-indigo-300">βοΈ 2. Hyperparameters</h2>
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-xs text-gray-400 mb-1">Learning Rate</label>
<input type="text" id="lr" value="2.5e-5" class="w-full bg-gray-900 border border-gray-700 rounded p-2 text-sm text-white" oninput="update()">
</div>
<div>
<label class="block text-xs text-gray-400 mb-1">Epochs</label>
<input type="number" id="epochs" value="2.3" step="0.1" class="w-full bg-gray-900 border border-gray-700 rounded p-2 text-sm text-white" oninput="update()">
</div>
</div>
</div>
<!-- Right Column: Output Preview & Script -->
<div class="space-y-6">
<!-- Summary Card -->
<div class="card p-6 shadow-xl border-l-4 border-indigo-500">
<h3 class="text-lg font-bold text-white mb-3">π Balance Summary</h3>
<div class="grid grid-cols-2 gap-2 text-sm text-gray-300 mb-3" id="summary_stats">
<!-- Populated by JS -->
</div>
<div class="w-full bg-gray-700 h-3 rounded-full overflow-hidden flex" id="balance_bar">
<!-- Populated by JS -->
</div>
</div>
<!-- Code Container -->
<div class="card p-6 shadow-xl">
<div class="flex justify-between items-center mb-3">
<h3 class="text-lg font-bold text-indigo-300">π Generated PyTorch / Colab Script</h3>
<button onclick="copyCode()" class="bg-gray-800 hover:bg-gray-700 text-xs px-3 py-1.5 rounded border border-gray-600 transition">
π Copy Code
</button>
</div>
<pre class="p-4 rounded-lg text-xs overflow-x-auto text-green-400 max-h-96" id="code_box"></pre>
</div>
</div>
</div>
</div>
<script>
function update() {
const ru_cot = parseInt(document.getElementById('ru_cot').value);
const ru_chat = parseInt(document.getElementById('ru_chat').value);
const en_chat = parseInt(document.getElementById('en_chat').value);
const math_cot = parseInt(document.getElementById('math_cot').value);
const code = parseInt(document.getElementById('code').value);
const lr = document.getElementById('lr').value;
const epochs = parseFloat(document.getElementById('epochs').value);
document.getElementById('val_ru_cot').innerText = ru_cot;
document.getElementById('val_ru_chat').innerText = ru_chat;
document.getElementById('val_en_chat').innerText = en_chat;
document.getElementById('val_math_cot').innerText = math_cot;
document.getElementById('val_code').innerText = code;
const total = ru_cot + ru_chat + en_chat + math_cot + code;
document.getElementById('summary_stats').innerHTML = `
<div>Total Samples: <b class="text-white">${total}</b></div>
<div>Est. T4 Time: <b class="text-white">~${Math.max(5, Math.round(total * epochs / 150))} min</b></div>
<div>Russian CoT: <b class="text-indigo-400">${Math.round(ru_cot/total*100)}%</b></div>
<div>Natural Chat: <b class="text-green-400">${Math.round((ru_chat+en_chat)/total*100)}%</b></div>
`;
const code_template = `# ==============================================================================
# Auto-Generated Training Script for LiquidAI/LFM2.5-350M
# Total Samples: ${total} | Epochs: ${epochs} | Learning Rate: ${lr}
# ==============================================================================
!pip install -q --upgrade "transformers>=4.48.0" "datasets>=3.0.0" "accelerate>=1.0.0"
import os, re, json, torch
from datasets import load_dataset, Dataset
from transformers import AutoModelForCausalLM, AutoTokenizer, Trainer, TrainingArguments, DataCollatorForSeq2Seq
from huggingface_hub import login
HF_TOKEN = "YOUR_HF_TOKEN"
BASE_MODEL = "LiquidAI/LFM2.5-350M"
TARGET_REPO = "KoarAI/LFM2.5-350M-Thinking-0003"
MAX_LENGTH = 512
login(token=HF_TOKEN)
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL, token=HF_TOKEN, trust_remote_code=True)
tokenizer.add_special_tokens({"additional_special_tokens": ["<think>", "</think>"]})
all_samples = []
# Dataset Mix Loader (${total} total samples)
# 1. Russian Deep CoT: ${ru_cot}
# 2. Russian Natural Dialogues: ${ru_chat}
# 3. English General Chat: ${en_chat}
# 4. Math & Logic CoT: ${math_cot}
# 5. Clean Code: ${code}
training_args = TrainingArguments(
output_dir="./lfm_output",
num_train_epochs=${epochs},
learning_rate=${lr},
lr_scheduler_type="cosine",
warmup_steps=40,
per_device_train_batch_size=2,
gradient_accumulation_steps=4,
weight_decay=0.01,
logging_steps=10,
bf16=torch.cuda.is_available()
)
`;
document.getElementById('code_box').innerText = code_template;
}
function copyCode() {
const code = document.getElementById('code_box').innerText;
navigator.clipboard.writeText(code);
alert("Training script copied to clipboard!");
}
update();
</script>
</body>
</html>
|