🔗 **Original ConceptAttention Integration**:
1. **Added einops Support**:
- Import einops for einsum operations (like original ConceptAttention)
- Fallback to torch operations if einops not available
- Added einops to requirements.txt
2. **Original ConceptAttention einsum Implementation**:
- Use einops.einsum for concept-image attention computation
- Follow exact approach from original paper: 'batch concepts dim, batch patches dim -> batch concepts patches'
- Maintain compatibility with torch operations as fallback
3. **Layer Selection Based on Original Paper**:
- Prioritize layers 15-19 (like original ConceptAttention)
- Higher scores for later layers (15-19 get 5000 points)
- Target specific Flux DiT attention components
4. **Enhanced Attention Layer Targeting**:
- SelfAttention: 2000 points (highest priority)
- DoubleStreamBlock attention: 1800 points
- Image/Text attention modules: 1600 points
- QKV layers: 1400 points
- Attention projection layers: 1200 points
5. **Improved Concept-Image Attention**:
- Use original ConceptAttention's einsum approach
- Better spatial structure handling
- Enhanced normalization and visualization
This brings the implementation much closer to the original
ConceptAttention paper while maintaining ComfyUI compatibility.
11 lines
102 B
Plaintext
11 lines
102 B
Plaintext
torch>=2.0.0
|
|
torchvision
|
|
transformers>=4.30.0
|
|
diffusers>=0.21.0
|
|
numpy
|
|
Pillow
|
|
scipy
|
|
matplotlib
|
|
einops
|
|
|