Add contrib models: LongCat-Image-Edit, Qwen-Image-Edit, Wan2.2-TI2V-5B#117
Open
whn09 wants to merge 7 commits intoaws-neuron:mainfrom
Open
Add contrib models: LongCat-Image-Edit, Qwen-Image-Edit, Wan2.2-TI2V-5B#117whn09 wants to merge 7 commits intoaws-neuron:mainfrom
whn09 wants to merge 7 commits intoaws-neuron:mainfrom
Conversation
Add three diffusion model adaptations for Trainium2 inference: - LongCat-Image-Edit: FLUX-style image editing (TP=4, CP=2/CFG Parallel) - Qwen-Image-Edit: Qwen-Image-Edit-2509 with 6 compilation variants - Wan2.2-TI2V-5B: Text/image-to-video generation with rolling cache All models compiled and tested on trn2.48xlarge with PyTorch 2.9 and neuronx-cc 2.22.
…rformance CFG Parallel is ~9% faster than Context Parallel when guidance_scale > 1. Updated compile.sh, run script, and README to use CFG as default. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…mance CFG Parallel is ~11% faster than Context Parallel at 512x512 (24.81s vs 27.93s). Updated compile.sh to use CFG as default (CP=1 to override), updated README. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…age-Edit Removed: - run_qwen_image_edit_debug.py (developer debugging script) - run_qwen_image_edit_gpu.py (CUDA GPU-only, not for Trainium) - test_attention_fix.py (one-time verification, not integration test) - visualize_vae_diff.py (developer diagnostic tool) - assets/output_edited.png (output example, not needed as test input) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…peedup Pass optimized compiler flags directly to ModelBuilder.compile() instead of relying on NEURON_CC_FLAGS env var, which is silently ignored. Changes: - Upgrade -O1 to -O2 - Add --lnc=2 for Trainium2 - Add --enable-ccop-compute-overlap to pipeline all-reduce with next layer compute - Add --cc-pipeline-tiling-factor=4 for finer-grained overlap scheduling Benchmarked on trn2.3xlarge (TP=4, WS=8, 512x384, 81 frames, 50 steps): Transformer fwd: 254.0ms -> 208.6ms (-17.9%) Step time: 0.612s -> 0.522s (-14.7%) MFU: 27.4% -> 33.8% (+6.4pp) Co-Authored-By: Claude <noreply@anthropic.com>
Pass ccop compute-overlap flags directly to ModelBuilder.compile() instead of relying on NEURON_CC_FLAGS env var, which is silently ignored when compiler_args is explicitly passed. Same fix as Wan2.2-TI2V-5B (PR #2), applied to all 6 remaining transformer compilation scripts in the diffusion-models branch: Pattern A (4 files): Added --lnc=2 and --tensorizer-options with ccop+tiling to existing compile_args parameter: - LongCat-Image-Edit/compile_transformer.py - LongCat-Image-Edit/compile_transformer_cfg.py - Qwen-Image-Edit/compile_transformer_v3_cfg.py - Qwen-Image-Edit/compile_transformer_v3_cp.py Pattern B (2 files): Added compile_args to builder.compile() which previously passed no compiler_args at all (flags only in env var): - Qwen-Image-Edit/compile_transformer_v2.py - Qwen-Image-Edit/compile_transformer_v2_flash.py Kept -O1 (original) since -O2 has not been benchmarked on these models. The ccop overlap optimization alone gave 17.9% speedup on Wan2.2-TI2V-5B. Co-Authored-By: Claude <noreply@anthropic.com>
…compiled_models paths - Wan2.2-TI2V-5B: Update CFG 512x384/81f perf 18.32s→15.77s, default height 512→384 - LongCat-Image-Edit: Update CFG perf 20.39s→18.17s, compiled_models→compiled_models_longcat - Qwen-Image-Edit: Add end-to-end total time column (~53s V3 CFG), fix CLI flags in example, compiled_models→compiled_models_qwen_image_edit - All: Add model name suffix to compiled_models/compiler_workdir paths to avoid conflicts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dae0470 to
e9b3ddf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add NxDI contrib models for three diffusion/generation models: LongCat-Image-Edit (FLUX-style image editing), Qwen-Image-Edit (Qwen2.5-VL-based image editing), and Wan2.2-TI2V-5B (text/image-to-video generation). All three run on trn2.48xlarge with CFG Parallel or Context Parallel strategies and include NKI Flash Attention kernels for Trainium2.
Model Information
Model Name: LongCat-Image-Edit, Qwen-Image-Edit, Wan2.2-TI2V-5B
Model Architecture: Multi-component diffusion models (Vision Encoder + Language Model + DiT/FLUX Transformer + VAE)
Purpose: Image editing (LongCat, Qwen), text/image-to-video generation (Wan2.2)
Checklist
Required Components
Accuracy Test (
test/integration/test_model.py)README.md with the following sections:
Source Code (
src/)Optional Components
test/integration/for each modelFolder Structure
Testing
How did you test this change?
All models compiled and tested end-to-end on trn2.48xlarge (Neuron SDK 2.22+, PyTorch 2.9).
LongCat-Image-Edit:
Qwen-Image-Edit:
Wan2.2-TI2V-5B:
Compatibility
Tested with:
Additional Information
Key design decisions shared across all models:
XLA_DISABLE_FUNCTIONALIZATION=1.LongCat-specific:
Qwen-Image-Edit-specific:
Wan2.2-specific:
feat_cachetensors on-device (HBM) via input-output aliasing, eliminates ~960MB roundtrip per callRelated Issues
N/A
vLLM Integration
By submitting this PR, I confirm that: