Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(video): FramePack gets back the VAE it was trained with

purplef06475f304c0
diff --git a/src/api/__tests__/framepack-vae.test.ts b/src/api/__tests__/framepack-vae.test.ts
new file mode 100644
index 00000000..8a413c00
--- /dev/null
+++ b/src/api/__tests__/framepack-vae.test.ts
@@ -0,0 +1,131 @@
+/**
+ * FramePack decodes again: the 1.0 transformer needs the 1.0 VAE.
+ *
+ * bob80817 (D#104): every FramePack run died with "Sizes of tensors must match
+ * except in dimension 2. Expected size 32 but got size 16 (FramePackSampler)".
+ * FramePack is a HunyuanVideo 1.0 model and its sampler allocates the history
+ * buffer with 16 latent channels; the HunyuanVideo 1.5 VAE encodes 32. Commit
+ * 6fb83d31 (09.04.2026) renamed the FramePack VAE to the 1.5 file while fixing
+ * a batch of unrelated filename typos, so every run since then paired the two.
+ *
+ * Run: npx vitest run src/api/__tests__/framepack-vae.test.ts
+ */
+import { describe, it, expect, vi, beforeEach } from 'vitest'
+
+vi.mock('../comfyui-nodes', async (importOriginal) => {
+ const actual = await importOriginal<typeof import('../comfyui-nodes')>()
+ return { ...actual, getAllNodeInfo: vi.fn() }
+})
+vi.mock('../backend', async (importOriginal) => {
+ const actual = await importOriginal<typeof import('../backend')>()
+ return { ...actual, localFetch: vi.fn(), comfyuiUrl: (p: string) => `http://test${p}` }
+})
+
+import { buildDynamicWorkflow } from '../dynamic-workflow'
+import { getAllNodeInfo } from '../comfyui-nodes'
+import { findMatchingVAE, COMPONENT_REGISTRY } from '../comfyui'
+import { localFetch } from '../backend'
+
+const VAE_10 = 'hunyuan_video_vae_bf16.safetensors'
+const VAE_15 = 'hunyuanvideo15_vae_fp16.safetensors'
+
+/** bob's disk after the FramePack bundle: both VAEs present, and the 1.5 file
+ * sorts FIRST in ComfyUI's enum, which is what decided the old first-hit. */
+const BOTH_VAES = [VAE_15, VAE_10, 'wan_2.1_vae.safetensors']
+
+const FRAMEPACK_NODES = {
+ UNETLoader: { input: { required: { unet_name: [['FramePack_F1_I2V_HY_20250503_fp8.safetensors']] } } },
+ VAELoader: { input: { required: { vae_name: [BOTH_VAES] } } },
+ DualCLIPLoader: { input: { required: { clip_name1: [['clip_l.safetensors']], clip_name2: [['llava_llama3_fp8_scaled.safetensors']], type: [['hunyuan_video']] } } },
+ CLIPVisionLoader: { input: { required: { clip_name: [['sigclip_vision_patch14_384.safetensors']] } } },
+ CLIPVisionEncode: { input: { required: {} } },
+ LoadFramePackModel: { input: { required: { model: [['FramePack_F1_I2V_HY_20250503_fp8.safetensors']] } } },
+ FramePackSampler: { input: { required: {} } },
+ LoadImage: { input: { required: { image: [['input_image.png']] } } },
+ ImageScale: { input: { required: {} } },
+ VAEEncode: { input: { required: {} } },
+ VAEDecode: { input: { required: {} } },
+ CLIPTextEncode: { input: { required: {} } },
+ SaveAnimatedWEBP: { input: { required: {} } },
+}
+
+const params = {
+ model: 'FramePack_F1_I2V_HY_20250503_fp8.safetensors',
+ prompt: 'a cat turns its head',
+ inputImage: 'cat.png',
+ width: 640, height: 640, steps: 25, cfgScale: 1.0,
+ frames: 49, fps: 16, seed: 42,
+}
+
+function vaeEnum(list: string[]) {
+ vi.mocked(localFetch).mockResolvedValue({
+ ok: true,
+ json: async () => ({ VAELoader: { input: { required: { vae_name: [list] } } } }),
+ } as never)
+}
+
+describe('findMatchingVAE — FramePack never gets a 32-channel VAE', () => {
+ beforeEach(() => vi.clearAllMocks())
+
+ it('picks the 1.0 VAE even though the 1.5 file sorts first', async () => {
+ vaeEnum(BOTH_VAES)
+ expect(await findMatchingVAE('framepack')).toBe(VAE_10)
+ })
+
+ it('NEGATIVE CONTROL: the old rule (first `hunyuan` hit) would have picked the 1.5 file', async () => {
+ // The exact expression this fix replaced. Kept as an executable record of
+ // what bob's crash was: on his enum it returns the 32-channel VAE.
+ const oldRule = BOTH_VAES.find(v => v.toLowerCase().includes('hunyuan') || v.toLowerCase().includes('wan'))
+ expect(oldRule).toBe(VAE_15)
+ vaeEnum(BOTH_VAES)
+ expect(await findMatchingVAE('framepack')).not.toBe(oldRule)
+ })
+
+ it('refuses a lone 1.5 VAE and names the file to download', async () => {
+ vaeEnum([VAE_15, 'sdxl_vae.safetensors'])
+ await expect(findMatchingVAE('framepack')).rejects.toThrow(VAE_10)
+ })
+
+ it('the 1.5 lane is untouched: hunyuan still picks its own VAE', async () => {
+ vaeEnum(BOTH_VAES)
+ expect(await findMatchingVAE('hunyuan')).toBe(VAE_15)
+ })
+
+ it('Wan 2.1 is 16-channel too, so it never falls into the 1.5 VAE either', async () => {
+ vaeEnum([VAE_15, VAE_10])
+ expect(await findMatchingVAE('wan')).toBe(VAE_10)
+ })
+
+ it('the download named in the registry is the 1.0 file', () => {
+ expect(COMPONENT_REGISTRY.framepack.vae!.downloadFilename).toBe(VAE_10)
+ })
+})
+
+describe('the built FramePack graph', () => {
+ beforeEach(() => {
+ vi.clearAllMocks()
+ vi.mocked(getAllNodeInfo).mockResolvedValue(FRAMEPACK_NODES as never)
+ vaeEnum(BOTH_VAES)
+ })
+
+ it('loads the 1.0 VAE, and both the encode and the decode read that one node', async () => {
+ const wf = await buildDynamicWorkflow(params as never)
+ const vaeNodes = Object.entries(wf).filter(([, v]) => (v as { class_type: string }).class_type === 'VAELoader')
+ expect(vaeNodes).toHaveLength(1)
+ const [vaeId, vaeNode] = vaeNodes[0]
+ expect((vaeNode as { inputs: { vae_name: string } }).inputs.vae_name).toBe(VAE_10)
+
+ // One VAE for the whole graph: encoding the start frame with a different
+ // VAE than the decode uses would be the same channel mismatch, one node on.
+ for (const cls of ['VAEEncode', 'VAEDecode', 'VAEDecodeTiled']) {
+ for (const [, node] of Object.entries(wf).filter(([, v]) => (v as { class_type: string }).class_type === cls)) {
+ expect((node as { inputs: { vae: [string, number] } }).inputs.vae[0]).toBe(vaeId)
+ }
+ }
+ })
+
+ it('a disk without the 1.0 VAE fails with the download hint, not a ComfyUI 400', async () => {
+ vaeEnum([VAE_15])
+ await expect(buildDynamicWorkflow(params as never)).rejects.toThrow(/No FramePack VAE found.*hunyuan_video_vae_bf16/s)
+ })
+})
diff --git a/src/api/__tests__/wan22-workflow.test.ts b/src/api/__tests__/wan22-workflow.test.ts
index 1fb87ccb..0ae00472 100644
--- a/src/api/__tests__/wan22-workflow.test.ts
+++ b/src/api/__tests__/wan22-workflow.test.ts
@@ -207,12 +207,22 @@ describe('findMatchingVAE — Wan 2.1 vs 2.2 (48-channel regression)', () => {
it("'wan22' picks the 2.2 VAE", async () => {
expect(await findMatchingVAE('wan22')).toBe('wan2.2_vae.safetensors')
})
- it("'wan' without a 2.1 file still refuses the 2.2 VAE (falls to hunyuan)", async () => {
+ it("'wan' without a 2.1 file falls to a 16-channel hunyuan VAE, never the 1.5 one", async () => {
+ // The 1.5 VAE is 32-channel and would crash Wan 2.1 exactly the way it
+ // crashed FramePack (bob80817, D#104), so it is not a fallback at all.
+ vi.mocked(localFetch).mockResolvedValue({
+ ok: true,
+ json: async () => ({ VAELoader: { input: { required: { vae_name: [['wan2.2_vae.safetensors', 'hunyuanvideo15_vae_fp16.safetensors', 'hunyuan_video_vae_bf16.safetensors']] } } } }),
+ } as never)
+ expect(await findMatchingVAE('wan')).toBe('hunyuan_video_vae_bf16.safetensors')
+ })
+
+ it("'wan' with ONLY a 32-channel VAE on disk refuses instead of crashing later", async () => {
vi.mocked(localFetch).mockResolvedValue({
ok: true,
json: async () => ({ VAELoader: { input: { required: { vae_name: [['wan2.2_vae.safetensors', 'hunyuanvideo15_vae_fp16.safetensors']] } } } }),
} as never)
- expect(await findMatchingVAE('wan')).toBe('hunyuanvideo15_vae_fp16.safetensors')
+ await expect(findMatchingVAE('wan')).rejects.toThrow('No Wan VAE found')
})
})
diff --git a/src/api/comfyui.ts b/src/api/comfyui.ts
index f109a90f..556212d9 100644
--- a/src/api/comfyui.ts
+++ b/src/api/comfyui.ts
@@ -417,7 +417,7 @@ export const COMPONENT_REGISTRY: Record<string, ComponentRequirements> = {
},
framepack: {
loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'wan',
- vae: { matchPatterns: ['hunyuan', 'wan'], downloadFilename: 'hunyuanvideo15_vae_fp16.safetensors' },
+ vae: { matchPatterns: ['hunyuan_video_vae', 'hunyuan'], downloadFilename: 'hunyuan_video_vae_bf16.safetensors' },
clip: { matchPatterns: ['llava', 'qwen', 'umt5'], downloadFilename: 'llava_llama3_fp8_scaled.safetensors' },
},
pyramidflow: {
@@ -820,6 +820,13 @@ export async function detectVideoBackend(): Promise<VideoBackend> {
// ─── Auto-find matching VAE/CLIP for a model ───
+/** HunyuanVideo 1.5 VAE (32-channel). FramePack and every other 1.0-era
+ * model must never be handed one. Matches `hunyuanvideo15_vae_fp16` as well
+ * as spaced-out spellings like `hunyuan_video_1.5_vae`. */
+function isHunyuan15Vae(name: string): boolean {
+ return /hunyuan[._-]?video[._-]?1[._-]?5/.test(name.toLowerCase())
+}
+
export async function findMatchingVAE(modelType: ModelType): Promise<string> {
const vaes = await getVAEModels()
if (vaes.length === 0) throw new Error('No VAE models found. Download a VAE for your model type from the Model Manager.')
@@ -864,9 +871,12 @@ export async function findMatchingVAE(modelType: ModelType): Promise<string> {
// .includes('wan') hit broke every Wan 2.1 generation. Prefer the 2.1 file
// explicitly and never fall into a 2.2 one.
const isWan22Vae = (v: string) => /wan[._]?2[._]?2/.test(lower(v))
+ // Same reason the HunyuanVideo 1.5 VAE is excluded here: it is 32-channel,
+ // so the last-resort hunyuan fallback would trade a missing-file message
+ // for the tensor crash FramePack was dying with (bob80817, D#104).
const match = vaes.find(v => /wan[._]?2[._]?1/.test(lower(v)))
|| vaes.find(v => lower(v).includes('wan') && !isWan22Vae(v))
- || vaes.find(v => lower(v).includes('hunyuan'))
+ || vaes.find(v => lower(v).includes('hunyuan') && !isHunyuan15Vae(v))
if (match) return match
throw new Error(`No Wan VAE found. Download "wan_2.1_vae.safetensors" from the Model Manager.`)
}
@@ -898,9 +908,13 @@ export async function findMatchingVAE(modelType: ModelType): Promise<string> {
throw new Error(`No CogVideoX VAE found. Download "cogvideox_vae_bf16.safetensors" from the Model Manager.`)
}
if (modelType === 'framepack') {
- const match = vaes.find(v => lower(v).includes('hunyuan') || lower(v).includes('wan'))
+ // 16-channel latents (HunyuanVideo 1.0). The 1.5 VAE is 32-channel and
+ // crashes the sampler, so it is excluded rather than merely deprioritised:
+ // on a disk holding both, first-hit order decided which one a run got.
+ const match = vaes.find(v => lower(v).includes('hunyuan') && !isHunyuan15Vae(v))
+ || vaes.find(v => lower(v).includes('wan'))
if (match) return match
- throw new Error(`No FramePack VAE found. Download "hunyuanvideo15_vae_fp16.safetensors" from the Model Manager.`)
+ throw new Error(`No FramePack VAE found. Download "hunyuan_video_vae_bf16.safetensors" from the Model Manager.`)
}
if (modelType === 'pyramidflow') {
const match = vaes.find(v => lower(v).includes('pyramid'))
diff --git a/src/api/discover.ts b/src/api/discover.ts
index e84f5eb4..f5be3074 100644
--- a/src/api/discover.ts
+++ b/src/api/discover.ts
@@ -439,7 +439,7 @@ export const COMPONENT_REGISTRY: Record<string, ComponentRequirements> = {
svd: { loader: 'ImageOnlyCheckpointLoader', needsSeparateVAE: false, needsSeparateCLIP: false },
framepack: {
loader: 'UNETLoader',
- vae: { patterns: ['hunyuan', 'wan'], downloadName: 'hunyuanvideo15_vae_fp16.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_1.5_repackaged/resolve/main/split_files/vae/hunyuanvideo15_vae_fp16.safetensors', subfolder: 'vae' },
+ vae: { patterns: ['hunyuan_video_vae', 'hunyuan'], downloadName: 'hunyuan_video_vae_bf16.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_repackaged/resolve/main/split_files/vae/hunyuan_video_vae_bf16.safetensors', subfolder: 'vae' },
clip: { patterns: ['llava', 'qwen'], downloadName: 'llava_llama3_fp8_scaled.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_repackaged/resolve/main/split_files/text_encoders/llava_llama3_fp8_scaled.safetensors', subfolder: 'text_encoders' },
needsSeparateVAE: true, needsSeparateCLIP: true,
},
@@ -1697,10 +1697,10 @@ export function getVideoBundles(): ModelBundle[] {
},
{
name: 'HunyuanVideo VAE',
- description: 'Required video encoder/decoder (shared with HunyuanVideo).',
- pulls: '', tags: ['VAE', '2.3 GB'], updated: '',
- downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_1.5_repackaged/resolve/main/split_files/vae/hunyuanvideo15_vae_fp16.safetensors',
- filename: 'hunyuanvideo15_vae_fp16.safetensors', subfolder: 'vae', sizeGB: 2.3,
+ description: 'Required video encoder/decoder (HunyuanVideo 1.0, the backbone FramePack was trained on).',
+ pulls: '', tags: ['VAE', '493 MB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_repackaged/resolve/main/split_files/vae/hunyuan_video_vae_bf16.safetensors',
+ filename: 'hunyuan_video_vae_bf16.safetensors', subfolder: 'vae', sizeGB: 0.5,
},
{
name: 'CLIP-L Text Encoder',
diff --git a/src/api/dynamic-workflow.ts b/src/api/dynamic-workflow.ts
index 794bb1a9..681eedeb 100644
--- a/src/api/dynamic-workflow.ts
+++ b/src/api/dynamic-workflow.ts
@@ -427,7 +427,7 @@ export async function buildDynamicWorkflow(
return buildWan22Workflow(params as VideoParams, seed, nodes, allNodes)
}
if (strategy === 'framepack') {
- return buildFramePackWorkflow(params as VideoParams, seed, nodes)
+ return await buildFramePackWorkflow(params as VideoParams, seed, nodes)
}
// ─── Standard Strategies (UNET/Checkpoint → CLIP → Latent → KSampler → VAEDecode) ───
@@ -1610,7 +1610,7 @@ export async function buildLocalOpWorkflow(params: LocalOpParams): Promise<Recor
}
}
-function buildFramePackWorkflow(params: VideoParams, seed: number, nodes: CategorizedNodes): Record<string, any> {
+async function buildFramePackWorkflow(params: VideoParams, seed: number, nodes: CategorizedNodes): Promise<Record<string, any>> {
const workflow: Record<string, any> = {}
let n = 1
@@ -1637,7 +1637,17 @@ function buildFramePackWorkflow(params: VideoParams, seed: number, nodes: Catego
// but llava_llama3 has 128320 tokens, causing state_dict size mismatch. DualCLIPLoader handles both correctly.
workflow[clipId] = { class_type: 'DualCLIPLoader', inputs: { clip_name1: 'clip_l.safetensors', clip_name2: 'llava_llama3_fp8_scaled.safetensors', type: 'hunyuan_video' } }
workflow[clipVisionId] = { class_type: 'CLIPVisionLoader', inputs: { clip_name: 'sigclip_vision_patch14_384.safetensors' } }
- workflow[vaeId] = { class_type: 'VAELoader', inputs: { vae_name: 'hunyuanvideo15_vae_fp16.safetensors' } }
+ // FramePack is a HunyuanVideo 1.0 model. Its sampler allocates the history
+ // buffer with 16 latent channels, and the HunyuanVideo 1.5 VAE encodes 32, so
+ // pairing the two dies at the first section with "Expected size 32 but got
+ // size 16" (bob80817, D#104). `6fb83d31` pinned this to the 1.5 file while
+ // fixing unrelated filename typos, which broke every FramePack run since.
+ //
+ // Resolved against the disk rather than pinned again: the resolver refuses a
+ // 1.5 VAE outright and names the file to fetch, so a customer whose bundle
+ // predates this fix reads "download hunyuan_video_vae_bf16" instead of a raw
+ // ComfyUI "value not in list" for a filename he never chose.
+ workflow[vaeId] = { class_type: 'VAELoader', inputs: { vae_name: await findMatchingVAE('framepack') } }
workflow[imageId] = { class_type: 'LoadImage', inputs: { image: params.inputImage || 'input_image.png' } }
// Scale the source to the resolved generation size before encoding (David
// 2026-06-11). FramePack otherwise samples at the full source resolution