Implement standard CacheDiT API compatibility layer with enhanced features #1
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.
This PR implements a comprehensive hybrid solution that adds full standard CacheDiT API compatibility while maintaining perfect integration with ComfyUI's ModelPatcher architecture. The implementation addresses the core requirement of supporting both standard API usage and ComfyUI node workflows.
Key Features Added
🔌 Standard CacheDiT API Support
The plugin now supports the complete standard CacheDiT API interface:
🎛 Enhanced ComfyUI Nodes
Added powerful new nodes while preserving all existing functionality:
📊 Multiple Caching Strategies
Implemented three intelligent caching strategies:
Technical Implementation
Enhanced Cache Engine
SimpleCachetoEnhancedCachewith full backward compatibilityCacheStrategyandModelCacheStatedataclasses for robust configurationAPI Compatibility Layer
api_compat.pythat exposes the standard CacheDiT interfaceget_global_stats(),set_global_config(),reset_cache_stats()Backward Compatibility
SimpleCachefunctions remain unchangedCacheDit 模型加速,CacheDit 统计信息) work exactly as beforeDocumentation & Examples
API.md)examples.py) covering all scenariosdemo_usage.py) showing expected behaviorPerformance Benefits
The enhanced implementation maintains the proven ~2x speedup on FLUX models while adding:
Usage Examples
Standard API workflow:
ComfyUI node workflow:
This implementation fulfills the original goal of creating a hybrid solution that bridges standard CacheDiT API expectations with ComfyUI's unique architecture, providing users with maximum flexibility while maintaining the performance benefits of the original caching approach.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.