Spaces:
Running
Running
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>NeuralForge - CPU LLM Training</title> | |
<script src="https://cdn.tailwindcss.com"></script> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
<style> | |
.gradient-bg { | |
background: linear-gradient(135deg, #1e3a8a 0%, #0ea5e9 100%); | |
} | |
.progress-bar { | |
height: 8px; | |
transition: width 0.3s ease; | |
} | |
.model-card:hover { | |
transform: translateY(-5px); | |
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); | |
} | |
.terminal { | |
font-family: 'Courier New', monospace; | |
height: 300px; | |
overflow-y: auto; | |
} | |
@keyframes pulse { | |
0%, 100% { | |
opacity: 1; | |
} | |
50% { | |
opacity: 0.5; | |
} | |
} | |
.animate-pulse { | |
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; | |
} | |
</style> | |
</head> | |
<body class="bg-gray-100 min-h-screen"> | |
<div class="gradient-bg text-white"> | |
<div class="container mx-auto px-4 py-6"> | |
<header class="flex justify-between items-center"> | |
<div class="flex items-center space-x-2"> | |
<i class="fas fa-brain text-3xl"></i> | |
<h1 class="text-2xl font-bold">NeuralForge</h1> | |
</div> | |
<nav class="hidden md:flex space-x-6"> | |
<a href="#" class="hover:text-blue-200">Dashboard</a> | |
<a href="#" class="hover:text-blue-200">Models</a> | |
<a href="#" class="hover:text-blue-200">Datasets</a> | |
<a href="#" class="hover:text-blue-200">Training</a> | |
<a href="#" class="hover:text-blue-200">Settings</a> | |
</nav> | |
<button class="md:hidden text-2xl"> | |
<i class="fas fa-bars"></i> | |
</button> | |
</header> | |
<div class="mt-12 mb-16 text-center"> | |
<h2 class="text-4xl font-bold mb-4">CPU-Powered LLM Training</h2> | |
<p class="text-xl max-w-2xl mx-auto">Train language models efficiently using your CPU resources with our optimized training pipeline</p> | |
</div> | |
</div> | |
</div> | |
<div class="container mx-auto px-4 py-8 -mt-10"> | |
<div class="bg-white rounded-xl shadow-lg p-6 mb-8"> | |
<div class="flex flex-col md:flex-row gap-6"> | |
<div class="md:w-2/3"> | |
<h3 class="text-xl font-semibold mb-4">Training Configuration</h3> | |
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> | |
<div> | |
<label class="block text-sm font-medium text-gray-700 mb-1">Model Architecture</label> | |
<select class="w-full p-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> | |
<option>GPT-2 Small</option> | |
<option>GPT-2 Medium</option> | |
<option>BERT Base</option> | |
<option>DistilBERT</option> | |
<option>Custom...</option> | |
</select> | |
</div> | |
<div> | |
<label class="block text-sm font-medium text-gray-700 mb-1">Training Dataset</label> | |
<select class="w-full p-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> | |
<option>Wikipedia (English)</option> | |
<option>BookCorpus</option> | |
<option>OpenWebText</option> | |
<option>Custom Dataset</option> | |
</select> | |
</div> | |
</div> | |
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6"> | |
<div> | |
<label class="block text-sm font-medium text-gray-700 mb-1">Batch Size</label> | |
<input type="number" value="8" min="1" max="32" class="w-full p-2 border border-gray-300 rounded-md"> | |
</div> | |
<div> | |
<label class="block text-sm font-medium text-gray-700 mb-1">Learning Rate</label> | |
<input type="number" step="0.00001" value="0.0001" class="w-full p-2 border border-gray-300 rounded-md"> | |
</div> | |
<div> | |
<label class="block text-sm font-medium text-gray-700 mb-1">Epochs</label> | |
<input type="number" value="3" min="1" max="100" class="w-full p-2 border border-gray-300 rounded-md"> | |
</div> | |
</div> | |
<div class="mb-6"> | |
<label class="block text-sm font-medium text-gray-700 mb-2">CPU Threads (Max: <span id="maxThreads">8</span>)</label> | |
<input type="range" min="1" max="8" value="4" class="w-full" id="threadSlider"> | |
<div class="flex justify-between text-xs text-gray-500"> | |
<span>1</span> | |
<span>2</span> | |
<span>3</span> | |
<span>4</span> | |
<span>5</span> | |
<span>6</span> | |
<span>7</span> | |
<span>8</span> | |
</div> | |
</div> | |
<div class="flex space-x-4"> | |
<button id="startTraining" class="px-6 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition flex items-center"> | |
<i class="fas fa-play mr-2"></i> Start Training | |
</button> | |
<button class="px-6 py-2 border border-gray-300 rounded-md hover:bg-gray-50 transition flex items-center"> | |
<i class="fas fa-save mr-2"></i> Save Config | |
</button> | |
<button id="stopTraining" class="px-6 py-2 border border-red-300 text-red-600 rounded-md hover:bg-red-50 transition flex items-center hidden"> | |
<i class="fas fa-stop mr-2"></i> Stop Training | |
</button> | |
</div> | |
</div> | |
<div class="md:w-1/3 bg-gray-50 p-4 rounded-lg"> | |
<h3 class="text-lg font-semibold mb-4">System Resources</h3> | |
<div class="mb-4"> | |
<div class="flex justify-between mb-1"> | |
<span class="text-sm font-medium">CPU Utilization</span> | |
<span id="cpuUsage" class="text-sm">0%</span> | |
</div> | |
<div class="w-full bg-gray-200 rounded-full h-2.5"> | |
<div id="cpuBar" class="bg-blue-600 h-2.5 rounded-full" style="width: 0%"></div> | |
</div> | |
</div> | |
<div class="mb-4"> | |
<div class="flex justify-between mb-1"> | |
<span class="text-sm font-medium">Memory Usage</span> | |
<span id="memUsage" class="text-sm">0 GB / 16 GB</span> | |
</div> | |
<div class="w-full bg-gray-200 rounded-full h-2.5"> | |
<div id="memBar" class="bg-green-600 h-2.5 rounded-full" style="width: 0%"></div> | |
</div> | |
</div> | |
<div class="mb-4"> | |
<div class="flex justify-between mb-1"> | |
<span class="text-sm font-medium">Disk Cache</span> | |
<span id="diskUsage" class="text-sm">0 GB / 50 GB</span> | |
</div> | |
<div class="w-full bg-gray-200 rounded-full h-2.5"> | |
<div id="diskBar" class="bg-purple-600 h-2.5 rounded-full" style="width: 0%"></div> | |
</div> | |
</div> | |
<div class="mt-6"> | |
<h4 class="text-sm font-semibold mb-2">Estimated Training Time</h4> | |
<div class="bg-white p-3 rounded-md border border-gray-200"> | |
<div class="flex items-center"> | |
<i class="fas fa-clock text-blue-500 mr-2"></i> | |
<span id="estTime">Calculating...</span> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8"> | |
<div class="bg-white rounded-xl shadow-lg p-6"> | |
<h3 class="text-xl font-semibold mb-4 flex items-center"> | |
<i class="fas fa-terminal mr-2 text-blue-500"></i> Training Log | |
</h3> | |
<div id="terminal" class="terminal bg-black text-green-400 p-4 rounded-md font-mono text-sm overflow-y-auto"> | |
<div>> Welcome to NeuralForge LLM Trainer</div> | |
<div>> System ready for training configuration</div> | |
<div>> CPU: 8 cores detected</div> | |
<div>> RAM: 16GB available</div> | |
</div> | |
</div> | |
<div class="bg-white rounded-xl shadow-lg p-6"> | |
<h3 class="text-xl font-semibold mb-4 flex items-center"> | |
<i class="fas fa-chart-line mr-2 text-blue-500"></i> Training Metrics | |
</h3> | |
<div class="grid grid-cols-2 gap-4 mb-4"> | |
<div class="bg-gray-50 p-3 rounded-md"> | |
<div class="text-sm text-gray-500">Loss</div> | |
<div id="lossValue" class="text-2xl font-bold">--</div> | |
</div> | |
<div class="bg-gray-50 p-3 rounded-md"> | |
<div class="text-sm text-gray-500">Perplexity</div> | |
<div id="perplexityValue" class="text-2xl font-bold">--</div> | |
</div> | |
</div> | |
<div class="h-48 bg-gray-50 rounded-md flex items-center justify-center"> | |
<p class="text-gray-400">Training metrics will appear here</p> | |
</div> | |
</div> | |
</div> | |
<div class="bg-white rounded-xl shadow-lg p-6 mb-8"> | |
<h3 class="text-xl font-semibold mb-6">Available Model Architectures</h3> | |
<div class="grid grid-cols-1 md:grid-cols-3 gap-6"> | |
<div class="model-card bg-gray-50 p-5 rounded-lg border border-gray-200 transition duration-300 cursor-pointer hover:border-blue-300"> | |
<div class="flex justify-between items-start mb-3"> | |
<h4 class="font-semibold">GPT-2 Small</h4> | |
<span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">Recommended</span> | |
</div> | |
<p class="text-sm text-gray-600 mb-4">117M parameters, good for most tasks</p> | |
<div class="text-xs text-gray-500"> | |
<div class="flex justify-between mb-1"> | |
<span>CPU RAM Needed:</span> | |
<span>4GB</span> | |
</div> | |
<div class="flex justify-between"> | |
<span>Training Time:</span> | |
<span>~12 hours</span> | |
</div> | |
</div> | |
</div> | |
<div class="model-card bg-gray-50 p-5 rounded-lg border border-gray-200 transition duration-300 cursor-pointer hover:border-blue-300"> | |
<div class="flex justify-between items-start mb-3"> | |
<h4 class="font-semibold">DistilBERT</h4> | |
</div> | |
<p class="text-sm text-gray-600 mb-4">66M parameters, distilled BERT model</p> | |
<div class="text-xs text-gray-500"> | |
<div class="flex justify-between mb-1"> | |
<span>CPU RAM Needed:</span> | |
<span>3GB</span> | |
</div> | |
<div class="flex justify-between"> | |
<span>Training Time:</span> | |
<span>~8 hours</span> | |
</div> | |
</div> | |
</div> | |
<div class="model-card bg-gray-50 p-5 rounded-lg border border-gray-200 transition duration-300 cursor-pointer hover:border-blue-300"> | |
<div class="flex justify-between items-start mb-3"> | |
<h4 class="font-semibold">TinyLLAMA</h4> | |
</div> | |
<p class="text-sm text-gray-600 mb-4">28M parameters, lightweight option</p> | |
<div class="text-xs text-gray-500"> | |
<div class="flex justify-between mb-1"> | |
<span>CPU RAM Needed:</span> | |
<span>2GB</span> | |
</div> | |
<div class="flex justify-between"> | |
<span>Training Time:</span> | |
<span>~5 hours</span> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<footer class="bg-gray-800 text-white py-8"> | |
<div class="container mx-auto px-4"> | |
<div class="flex flex-col md:flex-row justify-between"> | |
<div class="mb-6 md:mb-0"> | |
<h3 class="text-xl font-bold mb-4">NeuralForge</h3> | |
<p class="text-gray-400 max-w-md">Optimized CPU training for language models. No GPU required.</p> | |
</div> | |
<div class="grid grid-cols-2 md:grid-cols-3 gap-8"> | |
<div> | |
<h4 class="text-sm font-semibold uppercase tracking-wider mb-4">Product</h4> | |
<ul class="space-y-2"> | |
<li><a href="#" class="text-gray-400 hover:text-white">Features</a></li> | |
<li><a href="#" class="text-gray-400 hover:text-white">Pricing</a></li> | |
<li><a href="#" class="text-gray-400 hover:text-white">Documentation</a></li> | |
</ul> | |
</div> | |
<div> | |
<h4 class="text-sm font-semibold uppercase tracking-wider mb-4">Resources</h4> | |
<ul class="space-y-2"> | |
<li><a href="#" class="text-gray-400 hover:text-white">Blog</a></li> | |
<li><a href="#" class="text-gray-400 hover:text-white">Tutorials</a></li> | |
<li><a href="#" class="text-gray-400 hover:text-white">Support</a></li> | |
</ul> | |
</div> | |
<div> | |
<h4 class="text-sm font-semibold uppercase tracking-wider mb-4">Company</h4> | |
<ul class="space-y-2"> | |
<li><a href="#" class="text-gray-400 hover:text-white">About</a></li> | |
<li><a href="#" class="text-gray-400 hover:text-white">Careers</a></li> | |
<li><a href="#" class="text-gray-400 hover:text-white">Contact</a></li> | |
</ul> | |
</div> | |
</div> | |
</div> | |
<div class="mt-8 pt-8 border-t border-gray-700 flex flex-col md:flex-row justify-between items-center"> | |
<p class="text-gray-400 text-sm">© 2023 NeuralForge. All rights reserved.</p> | |
<div class="flex space-x-6 mt-4 md:mt-0"> | |
<a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-twitter"></i></a> | |
<a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-github"></i></a> | |
<a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-linkedin"></i></a> | |
</div> | |
</div> | |
</div> | |
</footer> | |
<script> | |
// Simulate training process | |
let trainingInterval; | |
let isTraining = false; | |
let epoch = 0; | |
let totalEpochs = 3; | |
let loss = 0; | |
let perplexity = 0; | |
document.getElementById('startTraining').addEventListener('click', startTraining); | |
document.getElementById('stopTraining').addEventListener('click', stopTraining); | |
document.getElementById('threadSlider').addEventListener('input', updateThreads); | |
function updateThreads() { | |
const threads = document.getElementById('threadSlider').value; | |
document.getElementById('maxThreads').textContent = threads; | |
updateEstTime(threads); | |
} | |
function updateEstTime(threads) { | |
const baseTime = 12; // hours for GPT-2 Small with 4 threads | |
const estTime = (baseTime * 4 / threads).toFixed(1); | |
document.getElementById('estTime').textContent = `~${estTime} hours`; | |
} | |
function startTraining() { | |
if (isTraining) return; | |
isTraining = true; | |
document.getElementById('startTraining').classList.add('hidden'); | |
document.getElementById('stopTraining').classList.remove('hidden'); | |
const terminal = document.getElementById('terminal'); | |
terminal.innerHTML += '<div>> Starting training process...</div>'; | |
terminal.scrollTop = terminal.scrollHeight; | |
epoch = 0; | |
loss = 4.5; | |
perplexity = 120; | |
// Update metrics | |
document.getElementById('lossValue').textContent = loss.toFixed(4); | |
document.getElementById('perplexityValue').textContent = Math.round(perplexity); | |
// Simulate resource usage | |
let cpuUsage = 10; | |
let memUsage = 2; | |
let diskUsage = 5; | |
trainingInterval = setInterval(() => { | |
// Simulate CPU usage | |
cpuUsage = Math.min(100, cpuUsage + Math.random() * 10); | |
document.getElementById('cpuUsage').textContent = Math.round(cpuUsage) + '%'; | |
document.getElementById('cpuBar').style.width = cpuUsage + '%'; | |
// Simulate memory usage | |
memUsage = Math.min(16, memUsage + Math.random() * 0.5); | |
document.getElementById('memUsage').textContent = memUsage.toFixed(1) + ' GB / 16 GB'; | |
document.getElementById('memBar').style.width = (memUsage / 16 * 100) + '%'; | |
// Simulate disk usage | |
diskUsage = Math.min(50, diskUsage + Math.random() * 2); | |
document.getElementById('diskUsage').textContent = diskUsage.toFixed(1) + ' GB / 50 GB'; | |
document.getElementById('diskBar').style.width = (diskUsage / 50 * 100) + '%'; | |
// Update training metrics | |
if (Math.random() > 0.7) { | |
loss = Math.max(0.5, loss - Math.random() * 0.3); | |
perplexity = Math.max(10, perplexity - Math.random() * 5); | |
document.getElementById('lossValue').textContent = loss.toFixed(4); | |
document.getElementById('perplexityValue').textContent = Math.round(perplexity); | |
// Add to terminal log | |
if (Math.random() > 0.8) { | |
epoch++; | |
const progress = Math.min(100, Math.round((epoch / totalEpochs) * 100)); | |
terminal.innerHTML += `<div>> Epoch ${epoch}/${totalEpochs} - Loss: ${loss.toFixed(4)} - Perplexity: ${Math.round(perplexity)}</div>`; | |
terminal.scrollTop = terminal.scrollHeight; | |
if (epoch >= totalEpochs) { | |
stopTraining(); | |
terminal.innerHTML += '<div class="text-green-300">> Training completed successfully!</div>'; | |
terminal.scrollTop = terminal.scrollHeight; | |
} | |
} | |
} | |
}, 1000); | |
} | |
function stopTraining() { | |
clearInterval(trainingInterval); | |
isTraining = false; | |
document.getElementById('startTraining').classList.remove('hidden'); | |
document.getElementById('stopTraining').classList.add('hidden'); | |
// Reset resource usage | |
document.getElementById('cpuUsage').textContent = '0%'; | |
document.getElementById('cpuBar').style.width = '0%'; | |
document.getElementById('memUsage').textContent = '0 GB / 16 GB'; | |
document.getElementById('memBar').style.width = '0%'; | |
document.getElementById('diskUsage').textContent = '0 GB / 50 GB'; | |
document.getElementById('diskBar').style.width = '0%'; | |
} | |
// Initialize | |
updateThreads(); | |
// Model card selection | |
document.querySelectorAll('.model-card').forEach(card => { | |
card.addEventListener('click', function() { | |
document.querySelectorAll('.model-card').forEach(c => { | |
c.classList.remove('border-blue-500', 'bg-blue-50'); | |
}); | |
this.classList.add('border-blue-500', 'bg-blue-50'); | |
}); | |
}); | |
</script> | |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=elgarrai/neuralfroge" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
</html> |