ComfyUI Extension: LoRA Matcher Nodes for ComfyUI
This custom node provides two different approaches to automatically match text prompts with LoRA models using their descriptions.
Custom Nodes (0)
README
LoRA Matcher Nodes for ComfyUI
This custom node provides two different approaches to automatically match text prompts with LoRA models using their descriptions.
šÆ Available Nodes
1. Prompt LoRA Matcher (Fuzzy) - Fast Text Matching
- Method: Fuzzy string matching using
rapidfuzz
- Speed: ā” Instant matching
- Accuracy: Good for exact/near-exact matches
- Requirements: None (works out of the box)
2. AI LoRA Matcher (Semantic) - Smart AI Matching
- Method: Semantic similarity using sentence-transformers
- Speed: š Slower first run (downloads model)
- Accuracy: š¤ Understands meaning, synonyms, concepts
- Requirements: Sentence-transformer models
š Model Setup (AI Matcher Only)
The AI matcher can work with or without local models:
Option 1: Automatic Download (Easiest)
- No setup required
- Models download automatically on first use
- Slower initial load (~30-60 seconds)
- Uses
all-MiniLM-L12-v2
by default (higher accuracy)
Option 2: Local Models (Recommended for Speed)
Place sentence-transformer models in: custom_nodes/ComfyUI-LoraPromptMatcher/model/
Recommended Models:
-
all-MiniLM-L12-v2 āā (DEFAULT - Higher accuracy)
- Size: ~45MB
- Speed: Medium
- Accuracy: āāāāā (Best semantic understanding)
-
all-MiniLM-L6-v2 (Faster alternative)
- Size: ~23MB
- Speed: ā” Fast
- Accuracy: āāāā (Good balance)
-
paraphrase-MiniLM-L6-v2 (Good for paraphrases)
- Size: ~23MB
- Speed: Fast
- Accuracy: Good for rephrased prompts
Download Instructions:
- Visit: https://huggingface.co/sentence-transformers/
- Search for your chosen model (e.g., "all-MiniLM-L6-v2")
- Download the model files
- Extract to:
custom_nodes/ComfyUI-LoraPromptMatcher/model/
- The directory structure should look like:
model/
āāā all-MiniLM-L6-v2/
ā āāā config_sentence_transformers.json
ā āāā sentence_bert_config.json
ā āāā config.json
ā āāā pytorch_model.bin
ā āāā tokenizer.json
ā āāā tokenizer_config.json
ā āāā vocab.txt
ā āāā special_tokens_map.json
āļø Configuration
LoRA Descriptions
Edit reference_descriptions.json
to add your LoRA models:
{
"my_lora.safetensors": "beautiful detailed portrait, realistic skin texture",
"anime_style.safetensors": "anime art style, vibrant colors, expressive eyes",
"cyberpunk.safetensors": "futuristic cyberpunk aesthetic, neon lights, high tech"
}
šØ Warning System
The AI matcher includes intelligent warnings:
No Models Found
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā š¤ AI MODELS NOT FOUND š¤ ā
ā ā
ā The AI LoRA Matcher requires sentence-transformer models for semantic ā
ā matching, but none were found in the model directory. ā
ā ā
ā RECOMMENDED MODELS: ā
ā ⢠all-MiniLM-L6-v2 (fast, good balance) ā
ā ⢠all-MiniLM-L12-v2 (better accuracy, slower) ā
ā ⢠paraphrase-MiniLM-L6-v2 (good for paraphrases) ā
ā ā
ā DOWNLOAD FROM: huggingface.co/sentence-transformers/ ā
ā Place model files in: custom_nodes/ComfyUI-LoraPromptMatcher/model/ ā
ā ā
ā ALTERNATIVE: The node will automatically download models from ā
ā HuggingFace on first use (may be slower). ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
GGUF Models Found (Wrong Type)
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā š GGUF MODELS FOUND - ST MODELS NEEDED š ā
ā ā
ā Found GGUF models but the AI LoRA Matcher needs sentence-transformer ā
ā models for semantic similarity matching. ā
ā ā
ā DOWNLOAD sentence-transformer models from: ā
ā huggingface.co/sentence-transformers/ ā
ā ā
ā Recommended: all-MiniLM-L6-v2 ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
šļø Usage
- Add either node to your ComfyUI workflow
- Connect a MODEL input
- Enter your text description
- Adjust strength if needed (default: 1.0)
- The node outputs the model with the matched LoRA applied
š Matching Examples
| Input Prompt | Fuzzy Match | AI Match | Notes |
|-------------|-------------|----------|--------|
| "beautiful woman portrait" | portrait_lora
(0.85) | portrait_lora
(0.92) | Both work well |
| "anime girl cute style" | anime_lora
(0.76) | anime_lora
(0.88) | AI better |
| "person eating apple fruit" | food_lora
(0.34) | food_lora
(0.78) | AI much better |
| "cyberpunk futuristic city" | No match (0.25) | cyberpunk_lora
(0.71) | Only AI finds it |
š§ Troubleshooting
AI Matcher Not Working
- Check console for warning messages
- Ensure model directory exists:
custom_nodes/ComfyUI-LoraPromptMatcher/model/
- Try automatic download first (delete local models if issues persist)
No LoRA Applied
- Check
reference_descriptions.json
has your LoRA files - Verify LoRA files exist in the correct ComfyUI loras folder
- Lower similarity threshold if matches are too strict
Performance Issues
- Use local models instead of automatic download
- Try smaller models like
all-MiniLM-L6-v2
- The fuzzy matcher is always faster for simple cases
š Notes
- The AI matcher caches embeddings for faster subsequent matches
- Fuzzy matching uses token-based similarity (good for typos)
- AI matching uses semantic understanding (better for concepts)
- Both methods have adjustable similarity thresholds
- Console output shows detailed matching information