15 Commits
Author SHA1 Message Date
Junst d6b546b653 Clean up and optimize workflow
- Remove unused simple files (concept_attention_simple.py, nodes_simple.py, test_nodes.py)
- Update example_workflow.json with improved structure
- Keep main concept_attention.py and nodes.py as primary implementation
- Streamline project structure for better maintainability
2025-09-24 16:13:50 +09:00
Junst 88b824b0ea Fix DualCLIPLoader outputs in workflow
- Add second CLIP output to DualCLIPLoader node
- Fix node link consistency issue between nodes 2 and 3
- Resolve ComfyUI link validation error
2025-09-24 16:05:44 +09:00
Junst 0382c3945e Fix workflow widgets_values for ConceptAttentionNode
- Add concept_list value to widgets_values array
- Ensure prompt and concept_list are properly set in workflow
- Fix Required input is missing validation errors
2025-09-24 16:02:32 +09:00
Junst 15e737d94c Fix workflow validation by adding missing inputs
- Add prompt and concept_list inputs to ConceptAttentionNode
- Fix Required input is missing validation errors
- Enable proper workflow execution in ComfyUI
2025-09-24 16:00:11 +09:00
Junst cfadc10246 Fix ConceptDiffusion for Flux dual CLIP architecture
🔧 **Flux Dual CLIP Integration**:

1. **Root Cause Analysis**:
   - CLIP errors: Wrong CLIP structure (single vs dual)
   - Attention issues: Failed text encoding due to wrong CLIP
   - Concept processing failure: No valid embeddings

2. **Dual CLIP Support**:
   - Updated workflow to use DualCLIPLoader
   - Proper Flux CLIP structure (CLIP-L + T5-XXL)
   - Enhanced text encoding for dual CLIP architecture

3. **Complete Fix**:
   - DiffusionModelLoader: flux1-dev.safetensors
   - DualCLIPLoader: clip_l + t5xxl for proper dual CLIP
   - ConceptDiffusion now supports Flux dual CLIP structure

This should resolve both CLIP errors and attention capture issues by using the correct Flux architecture.
2025-09-24 14:46:38 +09:00
Junst 2876086a8b Fix LoadImage output links in workflow
- Added link 7 to Node 1 (LoadImage) outputs array
- LoadImage now outputs to both Node 3 (ConceptAttentionNode) and Node 5 (ConceptSegmentationNode)
- Resolves 'origin(1).outputs[0].links does NOT contain it' validation error

The workflow link structure is now fully consistent.
2025-09-21 19:01:59 +09:00
Junst ec4b32cc53 Fix workflow link validation error
- Fixed duplicate link ID 1 usage in example_workflow.json
- Node 5 (ConceptSegmentationNode) now uses link 7 instead of link 1
- Added proper link definition [7, 1, 0, 5, 1, 'IMAGE'] to links array
- Resolves 'target(3).inputs[1].link is NOT correct' validation error

The workflow should now load without link validation errors.
2025-09-21 18:59:51 +09:00
Junst 7eecd3685e Fix attention_outputs error and alpha parameter issues
1. Fix 'attention_outputs' not defined error:
   - Change 'return attention_outputs' to 'return self.attention_outputs'
   - This fixes the NameError in ConceptAttention extraction

2. Fix alpha parameter validation issues:
   - Move alpha from 'required' to 'optional' in ConceptAttentionVisualizerNode
   - Remove alpha input from workflow JSON since it's now optional with default value
   - This resolves the 'Required input is missing: alpha' validation error

These changes ensure the workflow runs without validation errors while maintaining
the default alpha value of 0.5 for overlay blending.
2025-09-17 14:52:53 +09:00
Junst 30bf6d8d0a Fix ConceptAttentionVisualizerNode input parameter name
- Change 'overlay_alpha' to 'alpha' to match the node's INPUT_TYPES definition
- This fixes the validation error: 'Required input is missing: alpha'
2025-09-17 14:49:46 +09:00
Junst 6595d25bad Update workflow for elderly woman character example
- Remove VAE output from CheckpointLoaderSimple (not needed for ConceptAttention)
- Update example prompt to: 'Elderly woman character with white hair and a red dress holding a cane and accompanied by a small white cat on her shoulder. Cartoon style with smooth lines and exaggerated facial features offering a whimsical and friendly appearance. Her name is abae.'
- Update concept segmentation to: woman, cat, white, lines, cane
- Update concept saliency map default to: woman
- Update mock saliency map patterns for new concepts:
  * woman: center region (red)
  * cat: shoulder region (green)
  * white: scattered bright spots (white)
  * lines: horizontal/vertical line patterns (blue)
  * cane: vertical line on right side (magenta)
- Update color mappings in utils.py and nodes.py
- Fix workflow link validation issues
2025-09-17 14:02:15 +09:00
Junst 4b4667f15f Revert to CheckpointLoaderSimple to fix link errors
- Go back to CheckpointLoaderSimple which provides MODEL, CLIP, VAE outputs
- Remove separate UNETLoader, CLIPLoader, VAELoader that were causing link issues
- Fix link 3 to connect CheckpointLoaderSimple CLIP output to ConceptAttentionNode
- VAE is included but not used (ConceptAttention works on original images, not latents)
- This should resolve the 'origin(2).outputs[1].links does NOT contain it' error
2025-09-17 13:55:47 +09:00
Junst 901663a7a1 Fix workflow link error
- Fix link 3 to connect CLIPLoader (node 11) to ConceptAttentionNode (node 3)
- Previously incorrectly connected UNETLoader (node 2) which doesn't have CLIP output
- Workflow now properly connects MODEL from UNETLoader and CLIP from CLIPLoader
2025-09-17 13:53:18 +09:00
Junst ab9313138c Fix ModelPatcher errors and update workflow to use separate loaders
- Fix 'named_modules' error by adding fallback method for ModelPatcher
- Add mock saliency map generation for testing
- Update workflow to use UNETLoader, CLIPLoader, VAELoader instead of CheckpointLoaderSimple
- Improve error handling in nodes
- Fix tensor dimension issues in saliency map processing
- Add proper concept-based pattern generation for different object types
2025-09-17 12:03:07 +09:00
Junst 31dc847125 Fix workflow validation errors
- Remove invalid links 7 and 9 that were causing validation errors
- Fix MASK outputs to not connect to SaveImage nodes (SaveImage only accepts IMAGE)
- Update last_link_id to match actual number of links
- Workflow now validates correctly in ComfyUI
2025-09-17 11:55:06 +09:00
Junst 9a6b6ce77a Initial commit: ComfyUI-Concept-Diffusion implementation
- Implement ConceptAttention nodes for ComfyUI
- Add concept saliency map generation
- Add zero-shot segmentation capabilities
- Add visualization tools
- Include example workflow and tests
- Based on ConceptAttention paper (arXiv:2502.04320)
2025-09-17 11:36:27 +09:00