v1.8.0: 模块化重构 + 后台登录认证

This commit is contained in:
2026-06-01 18:31:39 +08:00
parent 27a7cdbb5b
commit c1ce44b741

220
templates/knowledge.html Normal file
View File

@@ -0,0 +1,220 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ParamHub - 参数百科</title>
<link rel="icon" type="image/svg+xml" href="/static/favicon.svg">
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdn.jsdelivr.net/npm/remixicon@3.5.0/fonts/remixicon.css" rel="stylesheet">
</head>
<body class="bg-gray-50 min-h-screen">
<nav class="bg-white shadow-sm sticky top-0 z-50">
<div class="max-w-7xl mx-auto px-4 py-3 flex justify-between items-center">
<a href="/" class="flex items-center gap-2">
<i class="ri-dashboard-3-line text-2xl text-indigo-600"></i>
<span class="text-xl font-bold text-gray-800">ParamHub</span>
</a>
<div class="flex gap-4 text-sm" id="topNav">
<!-- 动态加载 -->
</div>
</div>
</nav>
<main class="max-w-7xl mx-auto px-4 py-8">
<div class="mb-6">
<h1 class="text-2xl font-bold text-gray-800 flex items-center gap-2">
<i class="ri-book-open-line text-teal-600"></i>
知识库
</h1>
<p class="text-gray-500 mt-1">AI模型参数与硬件知识</p>
</div>
<div class="grid grid-cols-2 gap-6">
<!-- 参数量 -->
<div class="bg-white rounded-xl shadow-sm p-6">
<h2 class="text-lg font-semibold text-gray-800 mb-4 flex items-center gap-2">
<i class="ri-calculator-line text-blue-600"></i>
什么是参数量?
</h2>
<p class="text-gray-600 leading-relaxed">
参数量Parameters是衡量大模型规模的指标表示模型中权重参数的数量。
例如 GPT-3 有 175B 参数即约1750亿个参数。
</p>
<div class="mt-4 p-4 bg-blue-50 rounded-lg">
<div class="font-medium text-blue-800 mb-2">常见规模分类:</div>
<ul class="text-sm text-blue-600 space-y-1">
<li>• 小模型:&lt;1B (适合边缘设备)</li>
<li>• 中模型1B-10B (消费级GPU可运行)</li>
<li>• 大模型10B-100B (需要多GPU)</li>
<li>• 超大模型:&gt;100B (需要数据中心)</li>
</ul>
</div>
</div>
<!-- 上下文长度 -->
<div class="bg-white rounded-xl shadow-sm p-6">
<h2 class="text-lg font-semibold text-gray-800 mb-4 flex items-center gap-2">
<i class="ri-text-wrap text-green-600"></i>
什么是上下文长度?
</h2>
<p class="text-gray-600 leading-relaxed">
上下文长度Context Length是模型能处理的输入文本最大长度。
更长的上下文意味着模型可以理解更长的文档或对话历史。
</p>
<div class="mt-4 p-4 bg-green-50 rounded-lg">
<div class="font-medium text-green-800 mb-2">常见长度:</div>
<ul class="text-sm text-green-600 space-y-1">
<li>• 4K传统长度适合简单对话</li>
<li>• 32K中等长度适合长文档</li>
<li>• 128K超长上下文如GPT-4 Turbo</li>
<li>• 200KClaude 3的极限长度</li>
</ul>
</div>
</div>
<!-- 显存计算 -->
<div class="bg-white rounded-xl shadow-sm p-6">
<h2 class="text-lg font-semibold text-gray-800 mb-4 flex items-center gap-2">
<i class="ri-cpu-line text-orange-600"></i>
如何计算显存需求?
</h2>
<p class="text-gray-600 leading-relaxed">
模型显存需求 ≈ 参数量 × 每参数字节数 × 1.3含KV Cache开销
</p>
<div class="mt-4 p-4 bg-orange-50 rounded-lg">
<div class="font-medium text-orange-800 mb-2">计算公式:</div>
<ul class="text-sm text-orange-600 space-y-1">
<li>• FP32: 参数量 × 4字节 × 1.3</li>
<li>• FP16: 参数量 × 2字节 × 1.3</li>
<li>• INT8: 参数量 × 1字节 × 1.3</li>
<li>• INT4: 参数量 × 0.5字节 × 1.3</li>
</ul>
</div>
</div>
<!-- 量化 -->
<div class="bg-white rounded-xl shadow-sm p-6">
<h2 class="text-lg font-semibold text-gray-800 mb-4 flex items-center gap-2">
<i class="ri-scales-3-line text-purple-600"></i>
什么是量化?
</h2>
<p class="text-gray-600 leading-relaxed">
量化Quantization是将模型参数从高精度转换为低精度减少显存占用和计算量。
如FP16→INT8→INT4精度损失可控资源节省显著。
</p>
<div class="mt-4 p-4 bg-purple-50 rounded-lg">
<div class="font-medium text-purple-800 mb-2">量化效果:</div>
<ul class="text-sm text-purple-600 space-y-1">
<li>• FP32→FP16: 显存减半,精度基本不变</li>
<li>• FP16→INT8: 显存再减半,精度略降</li>
<li>• INT8→INT4: 显存再减半,需特殊技术</li>
</ul>
</div>
</div>
<!-- MMLU -->
<div class="bg-white rounded-xl shadow-sm p-6">
<h2 class="text-lg font-semibold text-gray-800 mb-4 flex items-center gap-2">
<i class="ri-bar-chart-box-line text-red-600"></i>
什么是MMLU
</h2>
<p class="text-gray-600 leading-relaxed">
MMLUMassive Multitask Language Understanding是评估大模型综合能力的标准测试集
覆盖57个学科领域分数越高代表模型知识面越广。
</p>
<div class="mt-4 p-4 bg-red-50 rounded-lg">
<div class="font-medium text-red-800 mb-2">分数参考:</div>
<ul class="text-sm text-red-600 space-y-1">
<li>• 60-70%入门级如GPT-3</li>
<li>• 70-80%中等水平如Llama 2 70B</li>
<li>• 80-90%优秀水平如GPT-4、Claude 3</li>
</ul>
</div>
</div>
<!-- HumanEval -->
<div class="bg-white rounded-xl shadow-sm p-6">
<h2 class="text-lg font-semibold text-gray-800 mb-4 flex items-center gap-2">
<i class="ri-code-box-line text-teal-600"></i>
什么是HumanEval
</h2>
<p class="text-gray-600 leading-relaxed">
HumanEval是评估模型代码能力的测试集包含164个编程题目。
分数表示模型能正确完成的题目比例。
</p>
<div class="mt-4 p-4 bg-teal-50 rounded-lg">
<div class="font-medium text-teal-800 mb-2">分数参考:</div>
<ul class="text-sm text-teal-600 space-y-1">
<li>• 20-30%:基础代码能力</li>
<li>• 40-50%:中等代码能力</li>
<li>• 80%+优秀代码能力如Claude 3 Opus</li>
</ul>
</div>
</div>
</div>
<!-- 选型指南 -->
<div class="bg-white rounded-xl shadow-sm p-6 mt-6">
<h2 class="text-lg font-semibold text-gray-800 mb-4 flex items-center gap-2">
<i class="ri-lightbulb-line text-yellow-600"></i>
GPU选型指南
</h2>
<table class="w-full">
<thead class="bg-gray-50">
<tr>
<th class="px-4 py-2 text-left text-sm font-medium text-gray-600">需求场景</th>
<th class="px-4 py-2 text-left text-sm font-medium text-gray-600">推荐GPU</th>
<th class="px-4 py-2 text-left text-sm font-medium text-gray-600">显存需求</th>
<th class="px-4 py-2 text-left text-sm font-medium text-gray-600">预算范围</th>
</tr>
</thead>
<tbody class="divide-y">
<tr><td class="px-4 py-2 text-gray-800">个人学习/推理7B</td><td class="px-4 py-2">RTX 3060 12GB</td><td class="px-4 py-2">12-16GB</td><td class="px-4 py-2 text-gray-600">$300</td></tr>
<tr><td class="px-4 py-2 text-gray-800">个人开发/推理13B</td><td class="px-4 py-2">RTX 3090/4090</td><td class="px-4 py-2">24GB</td><td class="px-4 py-2 text-gray-600">$700-$1600</td></tr>
<tr><td class="px-4 py-2 text-gray-800">小团队训练/推理70B</td><td class="px-4 py-2">A100 40GB x2</td><td class="px-4 py-2">80GB</td><td class="px-4 py-2 text-gray-600">$12,000</td></tr>
<tr><td class="px-4 py-2 text-gray-800">企业训练大模型</td><td class="px-4 py-2">H100 80GB集群</td><td class="px-4 py-2">数百GB</td><td class="px-4 py-2 text-gray-600">$30,000+</td></tr>
</tbody>
</table>
</div>
</main>
<script>
let categories = [];
// 加载导航栏
async function loadNav() {
const res = await fetch('/api/categories');
categories = await res.json();
const builtinPages = [
{name: '首页', href: '/'},
{name: '工具', href: '/tools'},
{name: '对比', href: '/compare'},
{name: '知识库', href: '/knowledge'}
];
const categoryPages = {
'ai-models': '/models',
'gpus': '/gpus',
'cpus': '/cpus'
};
let navHtml = '';
builtinPages.forEach(p => {
const isActive = window.location.pathname === p.href;
navHtml += `<a href="${p.href}" class="${isActive ? 'text-indigo-600 font-medium' : 'text-gray-600 hover:text-indigo-600'}">${p.name}</a>`;
});
categories.forEach(cat => {
const href = categoryPages[cat.id] || `/category/${cat.id}`;
navHtml += `<a href="${href}" class="text-gray-600 hover:text-indigo-600">${cat.name}</a>`;
});
document.getElementById('topNav').innerHTML = navHtml;
}
loadNav();
</script>
</body>
</html>