diff --git a/src/components/TableOfContents.astro b/src/components/TableOfContents.astro new file mode 100644 index 0000000..5d09006 --- /dev/null +++ b/src/components/TableOfContents.astro @@ -0,0 +1,143 @@ +--- +import type { MarkdownHeading } from 'astro'; + +interface Props { + headings: MarkdownHeading[]; + lang?: 'en' | 'zh'; +} + +const { headings, lang = 'en' } = Astro.props; + +// Filter for h2 and h3 headings only (level 2 & 3) +const tocHeadings = headings.filter((h) => h.depth === 2 || h.depth === 3); +const hasHeadings = tocHeadings.length >= 3; +--- + +{hasHeadings && ( + +)} + + diff --git a/src/content/posts/running-ai-video-locally-on-a-12gb-gpu.md b/src/content/posts/running-ai-video-locally-on-a-12gb-gpu.md index fbfd29f..4b40e15 100644 --- a/src/content/posts/running-ai-video-locally-on-a-12gb-gpu.md +++ b/src/content/posts/running-ai-video-locally-on-a-12gb-gpu.md @@ -61,6 +61,240 @@ Halving the pixel count does not halve the time — it cuts it to about a third. That is the usual superlinear scaling of a diffusion transformer, and it is the reason 480p exists as a draft tier at all. +
+
+ Interactive Tool +

Wan 2.2 TI2V-5B Render Time & VRAM Estimator

+

Simulate sampling duration, decode memory, and safe upscale segmentation based on my RTX 3060 12 GB benchmarks.

+
+
+
+ + +
+
+ +
+ + 5 s (121 frames @ 24fps) +
+
+
+ +
+ + 20 steps +
+
+
+
+
+ Estimated Total Render + ~17.9 min + 15.1m sampling + 2.8m decode +
+
+ Peak VRAM Usage + 12.1 GB + Tight fit on 12 GB card +
+
+ SeedVR2 1.5× Split Strategy + 3 segments + Max 41 frames/segment to prevent crash +
+
+
+ + + + + ## Failure one: the decode that runs out of host memory The first 720p attempt sampled fine and then died in the VAE decode: diff --git a/src/content/posts/zh/running-ai-video-locally-on-a-12gb-gpu.md b/src/content/posts/zh/running-ai-video-locally-on-a-12gb-gpu.md index 2c06de2..a81ac12 100644 --- a/src/content/posts/zh/running-ai-video-locally-on-a-12gb-gpu.md +++ b/src/content/posts/zh/running-ai-video-locally-on-a-12gb-gpu.md @@ -43,6 +43,234 @@ banner: /banners/running-ai-video-locally-on-a-12gb-gpu.jpg 像素数减半,时间不是减半,而是降到约三分之一。这是扩散 Transformer 典型的超线性关系,也正是 480p 这档草稿存在的理由。 +
+
+ 交互工具 +

Wan 2.2 TI2V-5B 渲染时间与显存估算器

+

基于 RTX 3060 12GB 实测基准数据,实时模拟不同分辨率、秒数与步数下的采样时长、显存需求与分段策略。

+
+
+
+ + +
+
+ +
+ + 5 秒(121 帧 @ 24fps) +
+
+
+ +
+ + 20 步 +
+
+
+
+
+ 预估总渲染耗时 + ~17.9 分钟 + 15.1分 采样 + 2.8分 解码 +
+
+ 峰值显存占用 + 12.1 GB + 12GB 显卡极限贴线 +
+
+ SeedVR2 1.5× 放大分段策略 + 3 个切片 + 每段 ≤41 帧,防止原生崩溃 +
+
+
+ + + + + ## 第一次失败:解码把主机内存吃光 第一次 720p 采样很顺利,然后死在 VAE 解码: diff --git a/src/pages/posts/[...slug].astro b/src/pages/posts/[...slug].astro index 1862c85..c95f053 100644 --- a/src/pages/posts/[...slug].astro +++ b/src/pages/posts/[...slug].astro @@ -1,6 +1,7 @@ --- import BaseLayout from '../../layouts/BaseLayout.astro'; import AuthorCard from '../../components/AuthorCard.astro'; +import TableOfContents from '../../components/TableOfContents.astro'; import { getCollection, render } from 'astro:content'; import { postLang } from '../../lib/lang'; import { countWords, readingMinutes } from '../../lib/reading-time'; @@ -16,7 +17,7 @@ export async function getStaticPaths() { } const { post } = Astro.props; -const { Content } = await render(post); +const { Content, headings } = await render(post); const lang = postLang(post.slug); @@ -119,6 +120,8 @@ const jsonLd = { )} + +