A comprehensive database system for classifying, managing, and deploying machine learning models with automated organization and symlink-based deployment.
ModelHub is a sophisticated model management system that:
- Automatically classifies AI models (LoRA, checkpoints, VAE, etc.) using multiple detection methods
- Stores models in a hash-based deduplication system
- Provides deployment automation with symlink management to target applications
- Offers both CLI and TUI interfaces for model management
- Main Database:
/mnt/llm/model-hub/modelhub.db
(models, metadata, deployment) - Classification Database:
/mnt/llm/model-hub/classification.db
(types, rules, patterns) - Working Copy:
./modelhub.db
(empty, for development) - Architecture: Dual SQLite databases for separation of concerns
- Total Models: 539 active models
- Primary Types:
- LoRA: 360 models (67%)
- Checkpoint: 98 models (18%)
- UNet: 38 models (7%)
- GGUF: 12 models (2%)
- VAE: 8 models (1.5%)
- Other: 23 models (embeddings, CLIP, text encoders, etc.)
/mnt/llm/model-hub/
├── modelhub.db # Main database (models, metadata, deployment)
├── classification.db # Classification database (types, rules, patterns)
└── models/ # Hash-organized model storage
├── 00674ab0e236.../ # Model hash directories
│ └── model-file.safetensors
├── 00d7af617872.../
│ └── another-model.safetensors
└── ...
modelhub.py
- Main application entry point with TUI launchertui.py
- Terminal user interface with full model managementdatabase.py
- Database operations and model managementclassifier.py
- Model classification enginecreate_default_deploy.py
- Deployment configuration setup
config.yaml
- Main configuration fileCLAUDE.md
- Project documentation and AI assistant instructions
- models - Primary model records with classification data
- model_metadata - Extended key-value metadata storage
- deploy_targets - Deployment destination configurations
- deploy_mappings - Model type to folder path mappings
- deploy_links - Symlink deployment tracking
- model_types - Supported model type definitions (checkpoint, lora, vae, etc.)
- sub_type_rules - Pattern-based sub-type classification (flux, sdxl, pony, etc.)
- size_rules - File size-based classification rules
- architecture_patterns - Tensor analysis patterns for deep classification
- external_apis - External service configurations (CivitAI, etc.)
Note: See ClassifyLogic.md for detailed classification system documentation.
- Filename Analysis - Pattern matching on filenames
- File Size Analysis - Size-based type detection
- Metadata Extraction - SafeTensors/GGUF metadata parsing
- Tensor Analysis - Deep model architecture inspection
- External APIs - CivitAI and other service integration
- Weighted scoring across all detection methods
- Configurable confidence thresholds
- Manual override capabilities
- Reclassification support
- ComfyUI:
~/comfy/ComfyUI/models
- WAN Video:
~/pinokio/api/wan.git/app
- Forge WebUI:
~/pinokio/api/stable-diffusion-webui-forge.git/app/models
- Image Upscale:
~/pinokio/api/Image-Upscale.git/models
Each target has specific folder mappings for different model types:
- Checkpoints →
checkpoints/
orStable-diffusion/
- LoRAs →
loras/
orLora/
- VAE →
vae/
orVAE/
- ControlNet →
controlnet/
orControlNet/
- etc.
Models are deployed via symlinks from hash-organized storage to target application folders, maintaining organization while avoiding duplication.
- Database schema and infrastructure
- Model classification system with multi-method detection
- Hash-based storage with deduplication
- Metadata extraction and storage
- Basic deployment configuration
- CLI interface
- TUI interface with full model management
- Runtime symlinks toggle (Shift+Y hotkey)
- Model scanning with symlink conversion
- Comprehensive model reclassification
- Model metadata viewing and management
- Hash file generation
- Clipboard integration for symlink commands
- Live filtering and sorting in TUI
- Model deletion with soft delete support
- Deploy Stub Creation - Building symlink-based deployment system
- Product Folder Creation - Automated symlink deployment to target applications
- Deployment Management - Enable/disable targets, track deployment status
- Broken Symlink Cleanup - Maintenance utilities
- Deployment Status Dashboard - Monitor deployed vs available models
- Batch Operations - Deploy/undeploy multiple models
- Model Deduplication Tools - Find and manage duplicate models
- Orphaned File Cleanup - Clean up unused model files
- Export/Import Functions - Model sharing and backup
- Python 3.x
- SQLite database
- SafeTensors library support
- GGUF format support
- External API integrations
- Hash-based Storage - Prevents duplication, enables safe symlinks
- Multi-method Classification - Robust model type detection
- Symlink Deployment - Efficient space usage, maintains single source
- Extensible Architecture - Easy to add new model types and targets
- Metadata Preservation - Rich model information storage
- Path:
/mnt/llm/model-hub
(configurable in config.yaml) - Page Size: 1000 models per page (configurable)
- Symlinks: Runtime toggle (Shift+Y), defaults to enabled each session
.safetensors
(primary format).ckpt
(legacy checkpoints).pth
/.pt
(PyTorch models).gguf
(GGML Universal Format)
- Confidence Threshold: 0.5
- External APIs: Enabled
- CivitAI Reclassification: Enabled
# View model statistics
python modelhub_cli.py stats
# Launch TUI
python modelhub.py
# Create deployment configuration
python create_default_deploy.py
# Scan and import models (TUI has Shift+S hotkey)
python modelhub_cli.py scan /path/to/models
Navigation:
↑/↓ - Navigate models
PgUp/PgDn - Jump by page
←/→ - Previous/next page
ENTER/'d' - Show model details
Filtering:
Click filter fields or 'F' - Activate filtering
Tab - Move between filter fields
'n' - Toggle non-CivitAI filter
'r' - Reset all filters
Model Management:
'S' - Scan directory for new models
'R' - Reclassify models
'X' - Delete selected models
'H' - Generate hash files
'Y' - Toggle symlinks on/off (defaults to on)
Deployment:
'D' - Deploy menu
'c' - Configure deploy targets
'e' - Export models
Other:
'h' - Toggle help screen
'q' - Quit application
# View model types
sqlite3 /mnt/llm/model-hub/modelhub.db "SELECT primary_type, COUNT(*) FROM models WHERE deleted = 0 GROUP BY primary_type"
# Check deployment targets
sqlite3 /mnt/llm/model-hub/modelhub.db "SELECT name, display_name, enabled FROM deploy_targets"
- Complete Deploy Stub Implementation - Create the symlink deployment system
- Enable Deployment Targets - Activate and test deployment to target applications
- Testing and Validation - Ensure deployment system works correctly
- Documentation Updates - User guides and deployment instructions
- Web Interface - Browser-based model management
- Model Versioning - Track model updates and changes
- Performance Optimization - Speed improvements for large collections
- Advanced Search - Rich filtering and search capabilities
- Model Analytics - Usage statistics and insights
- The system uses a working directory setup with the main database in
/mnt/llm/model-hub/
- Development database is at
./modelhub.db
for testing - The project follows defensive coding practices with comprehensive error handling
- All database operations include proper transaction management
- The classification system is designed to be extensible and configurable
- modelhub.py - Application entry point and core logic
- database.py - Database abstraction layer and operations
- classifier.py - Model classification and analysis engine
- tui.py - Terminal user interface implementation
- config.py - Configuration management
- create_default_deploy.py - Deployment setup utility
- db_update.py - Database migration and updates
- hubclassify.py - Standalone classification utility
- clipboard_utils.py - Cross-platform clipboard integration
- modelhub_cli.py - Original CLI interface
- Various utilities - Legacy tools and migration scripts
- config.yaml - Main application configuration
- requirements.txt - Python dependencies
- CLAUDE.md - AI assistant instructions and project documentation
This README provides a comprehensive overview of the ModelHub project's current state, architecture, and development roadmap. It serves as both documentation and a reference for continuing development work.
📋 README Update Protocol: This README must be kept current as development progresses. When implementing new features, fixing bugs, or making architectural changes:
- Update Status Sections - Move items from "Planned" to "In Progress" to "Completed"
- Modify Statistics - Update model counts and database metrics
- Add New Features - Document new capabilities and usage examples
- Update Architecture - Reflect changes to database schema, file structure, or technical components
- Revise Configuration - Update settings, paths, and configuration examples
- Maintain Accuracy - Ensure all technical details remain current and accurate