A sophisticated, artist-friendly model merging toolkit for Stable Diffusion and Flux.1
Derived from Chattiori Model Merger by Chattiori
Violet Model Merge is a fast, deterministic checkpoint merger for Stable Diffusion (SD1.x/2.x/XL) and Flux.1 models. Built for AI artists who want precise control over model blending with an intuitive interface.
π Multiple Merge Algorithms β 20+ sophisticated merge modes from simple weighted sums to advanced cosine structure blending
π» Interactive Notebook β Artist-friendly Jupyter interface with comprehensive documentation and clean error handling
π Metadata Editor β CSV-based SafeTensors metadata management for batch editing descriptions, authors, and tags
β‘ GPU Acceleration β CUDA support for faster merging of large models
π‘οΈ Robust Error Handling β Clear, friendly error messages with detailed logging
π― Deterministic Results β Consistent, reproducible merges every time
π§ Flexible I/O β Support for .safetensors, .ckpt, and multiple precision formats
π Progress Tracking β Real-time progress bars and status updates
π¨ VAE Integration β Seamless VAE baking and model pruning
| Method | Description | Best For |
|---|---|---|
| WS (Weighted Sum) | Linear interpolation between models | Basic style blending |
| AD (Add Difference) | Preserves structure while adding characteristics | Advanced style transfer |
| SIG (Sigmoid) | Smooth, non-linear blending curves | Natural artistic transitions |
| DARE | Experimental drop-and-rescale algorithm | Novel model combinations |
| FREQ | Frequency-domain convolution merging | Technical fine-tuning |
| TIES | Structured parameter combination | Complex multi-model blends |
| And 15+ more... | Including cosine, sparse, and geometric methods | Every creative workflow |
# Clone the repository
git clone https://github.com/leylahviolet/Violet-Model-Merge.git
cd Violet-Model-Merge
# Install dependencies
pip install -r requirements.txtπ Interactive Notebook (Recommended)
Perfect for AI artists who want a guided, visual experience:
jupyter lab violet_merge.ipynbFor advanced users who prefer terminal workflows:
python lib/merge_model.py WS models "model_a.safetensors" "model_b.safetensors" --alpha 0.4π Metadata Manager
CSV-based SafeTensors metadata editing for batch operations:
jupyter lab metadata_manager.ipynbThe metadata manager notebook provides a powerful, user-friendly way to edit SafeTensors metadata in bulk using CSV files. Perfect for maintaining clean, consistent metadata across your entire model collection! π
- π€ Export to CSV β Extract metadata from models/VAEs into editable spreadsheets
- βοΈ Easy Editing β Use Excel, Google Sheets, or any CSV editor you prefer
- π₯ Safe Import β Apply changes back with automatic backups and validation
- π Non-destructive β Original files are backed up before any changes
- π― Batch Processing β Edit hundreds of models at once efficiently
- π Export β
metadata_manager.ipynbcreates editable CSV from your models - βοΈ Edit β Open CSV in your favorite editor, update descriptions, authors, tags
- πΎ Import β Apply changes back to your models with automatic validation
- π·οΈ Bulk Tagging β Add consistent tags across model collections
- π€ Author Updates β Set proper attribution for all your models
- π Descriptions β Add detailed descriptions for better organization
- π Version Control β Track model versions and modifications
- π§Ή Cleanup β Standardize metadata formatting across collections
Core Dependencies:
- Python 3.8+ (3.12+ recommended)
- PyTorch 2.0+ with CUDA support (optional but recommended)
- safetensors for fast, secure model loading
- diffusers for modern Stable Diffusion support
Optional Enhancements:
- CUDA toolkit for GPU acceleration
- Jupyter Lab for the interactive notebook experience
All dependencies are automatically installed via:
pip install -r requirements.txtViolet-Model-Merge/
βββ π violet_merge.ipynb # Main interactive notebook
βββ οΏ½ metadata_manager.ipynb # CSV-based metadata editor
βββ οΏ½π lib/ # Core Python modules
β βββ merge_model.py # Main merging engine
β βββ utils.py # Utility functions
β βββ metadata_csv.py # Metadata management
β βββ lora_bake.py # LoRA integration
βββ π models/ # Your model files (.safetensors, .ckpt)
βββ π vae/ # VAE files for baking
βββ π pyproject.toml # Modern Python packaging
βββ π CHANGELOG.md # Version history and updates
βββ π requirements.txt # Python dependencies
The interactive notebook provides the best experience for AI artists with guided examples, comprehensive documentation, and clean error handling.
-
Launch Jupyter Lab:
jupyter lab violet_merge.ipynb
-
Configure Your Paths (First cell):
# Set your model and VAE directories models_path = "../../ComfyUI/models/checkpoints" vae_path = "../../ComfyUI/models/vae" # Choose your models model_1 = "realistic_base.safetensors" model_2 = "anime_style.safetensors" vae_model = "anything-v4.0.vae.pt"
-
Run Merges with Beautiful Progress Tracking:
# Simple weighted merge result = run_merge( mode="WS", model0=model_1, model1=model_2, alpha=0.3, # 70% model_1, 30% model_2 output_name="realistic_anime_blend" )
- π Comprehensive Documentation β Each merge method explained with when/why to use it
- π§ Ready-to-Run Examples β Copy, paste, and customize for your models
- π Clean Progress Tracking β Real-time updates without technical noise
- ποΈ Easy Configuration β Set paths once, use everywhere
- π‘οΈ Friendly Error Handling β Clear, non-blocking error messages
- π Detailed Logging β Full technical details saved to
last_merge.log
# Blend two artistic styles
result = run_merge(
mode="SIG", # Sigmoid for smooth blending
model0="photoreal_base.safetensors",
model1="artistic_style.safetensors",
alpha=0.25, # Subtle artistic influence
output_name="photoreal_with_style"
)# Preserve base structure, inject style and details
result = run_merge(
mode="AD", # Add Difference
model0="base_structure.safetensors", # Foundation model
model1="style_details.safetensors", # Style characteristics
model2="fine_details.safetensors", # Additional features
alpha=0.3, # Style strength
cosine0=True, # Preserve model0 structure
memo="Complex artistic blend"
)For advanced users who prefer terminal workflows and automation scripts.
python lib/merge_model.py <MODE> <model_path> <model_0> <model_1> [OPTIONS]python lib/merge_model.py WS models "A.safetensors" "B.safetensors" \
--alpha 0.45 --output merged_ws --save_safetensors --save_halfpython lib/merge_model.py WS models "A.safetensors" "B.safetensors" \
--cosine1 --alpha 0.35 --output merged_cos1python lib/merge_model.py AD models "A.safetensors" "B.safetensors" \
--model_2 "C.safetensors" --alpha 0.25 --beta 0.15 --output merged_blendpython lib/merge_model.py SIG models "base.safetensors" "style.safetensors" \
--alpha 0.4 --vae "vae.pt" --device cuda --output gpu_blendpython lib/merge_model.py DARE models "A.safetensors" "B.safetensors" \
--alpha 0.4 --beta 0.3 --seed 42 --output dare_experimentpython lib/merge_model.py FREQ models "A.safetensors" "B.safetensors" \
--model_2 "C.safetensors" --alpha 0.4 --output freq_blendpython lib/merge_model.py NoIn models "FluxModel.safetensors" "dummy.safetensors" \
--fine "2,0,1,0,0,5" --output flux_finetunedpython lib/merge_model.py RM models "A.safetensors" "dummy.safetensors" --output meta_dump- WS (Weighted Sum): Basic linear interpolation
- AD (Add Difference): A + (B - C) structure preservation
- SIG (Sigmoid): Non-linear smooth blending
- INV (Inverse Sigmoid): Reverse sigmoid curves
- DARE: Drop and Re-scale experimental method
- TIES: Task Interference-aware merging
- FREQ: Frequency domain convolution
- SPRSE: Sparse top-k parameter selection
- Cosine: Preserve model structure while blending parameters
- Tensors: Fine-grained layer-wise control
- Block Weight: Precision control over UNet blocks
- NoIn: No interpolation (finetuning only)
- RM: Read metadata without merging
- PINS: Pin specific parameters during merge
- --alpha: Primary blend ratio (0.0 = model0, 1.0 = model1)
- --beta: Secondary ratio for 3-model merges
- --gamma: Tertiary ratio for complex algorithms
- --cosine0, --cosine1, --cosine2: Preserve specific model structure
- --use_dif_10, --use_dif_20, --use_dif_21: Reuse model diffs internally
- --output: Output filename (without extension)
- --save_safetensors: Save in safetensors format
- --save_half: Use fp16 precision
- --save_quarter: Use fp8 precision (experimental)
- β‘ Optimized Execution β Dramatically faster processing with streamlined merge logic
- π Real Performance β 3-model merges complete in seconds, not hours
- πΎ Memory Efficient β Optimized for large model handling with reduced memory footprint
- --device: Choose cpu/cuda/auto for processing
- --vae: Bake VAE into the merged model
- --prune: Remove unnecessary parameters
Performance Note: Version 1.2.1 includes major performance optimizations resulting in dramatically faster merge times. What used to take hours now completes in seconds! π
- VAE bake:
--vae path/to/vae.safetensorsreplacesfirst_stage_model.* - Pruning:
--prune(with--keep_ema) to slim the checkpoint; architecture-aware - DTypes:
--save_half(fp16) is widely supported;--save_quarter(fp8) is experimental
See CHANGELOG.md for detailed version history and updates.
Latest highlights:
- β¨ v1.2.1 β Major performance boost! Optimized merge execution with dramatically faster processing
- β¨ v1.2.0 β Interactive Jupyter notebook with artist-friendly interface
- π‘οΈ v1.1.0 β Enhanced error handling and progress tracking
- π§ v1.0.0 β Project restructure with modern packaging
The Violet Model Merge builds upon the incredible work of the open-source AI community. Special thanks to:
π Chattiori β Original Architect
The brilliant mind behind the core merging algorithms and mathematical foundations that make this tool possible
- eyriewow β Original merge-models architecture
- hako-mikan β Advanced merge algorithms and cosine methods
- lopho & arenasys β Model pruning techniques
- idelairre β Geometric, Sigmoid, and Max merge implementations
- s1dlx β Multiply Difference and Similarity Add Difference algorithms
- bbc-mc β Block-weighted merging interface
- martyn β DARE algorithm implementation
- mlfoundations/wise-ft β Theoretical foundation for DARE method
- LatteLeopard - Merge method descriptions
This project stands on the shoulders of giants. π
This project is licensed under the MIT License - see the LICENSE file for details.
Built with π by the AI art community β For artists, by artists