fix(core-ai): fit video generation in iphone memory

Open
#306 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
ios, react-native, typescript
Domain
ai, mobile, performance

Research direction

Start with the video generation harness test and the WanPipeline loading behavior mentioned in the issue; reproduce the memory pressure on an iPhone. Compare whether the text encoder remains resident during denoising and investigate the listed export and entitlement options. Done means the video generation harness test passes on an iPhone.

Written by the indexing model from the issue text.

Description

Blocked

coreAI.videoModel(...) runs Wan 2.1 T2V 1.3B bundles, and works on macOS: the iOS export generates 81 frames at 832x480 in about 5 minutes with 2 steps, peaking at 6.9 GB.

On an iPhone 17 Pro (iOS 27) the example app is killed about 3 minutes into generation. The decoder first failed to allocate its Metal heap, and with a decoder exported for 32x32 latent tiles the app is still killed by memory pressure. Apple's recipe traces the transformer for a fixed 60x104 latent (832x480) and the decoder for all 21 latent frames, so there is no smaller export to fall back on.

Options:

  • The com.apple.developer.kernel.increased-memory-limit entitlement, added through the Expo config plugin. The example app's signing profile cannot carry capabilities today, so testing it needs an App ID the team owns, and a Release build
  • A recipe change that traces a smaller latent (for example 480x480) or fewer frames, contributed to apple/coreai-models
  • Loading the text encoder (3.1 GB) only for the prompt and releasing it before denoising, if WanPipeline's lazy loading keeps it resident

Done when the video generation harness test passes on an iPhone.

Follow-up from #237.

🤖 Generated with Claude Code

Dominant language
TypeScript
Stars
1.4k
Forks
64
Avg merge
11h 8m
Merged PRs (30d)
2

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from callstackincubator/ai

All issues in callstackincubator/ai

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.