A Python-based intelligent assistant that detects your local hardware capabilities and recommends optimal AI models with appropriate quantization settings. Built with a modern, modular architecture featuring async hardware detection, rich CLI interface, and comprehensive caching.
- 🔍 Smart Hardware Detection: Automatically detects CPU, RAM, and GPU capabilities across Linux, macOS, and Windows
- 🎯 Intelligent Recommendations: Scores models based on your specific use case and hardware constraints
- ⚡ Async Performance: Parallel hardware detection for faster startup times
- 💾 Caching: Hardware detection results cached for subsequent runs
- 🎨 Beautiful CLI: Rich terminal interface with progress bars, tables, and formatted output
- 📊 Multiple Export Formats: Save recommendations as JSON, CSV, or YAML
- 🔧 Configuration Persistence: Saves your preferences between sessions
- 🧪 Comprehensive Testing: Full test suite with hardware mocking
pip install -r requirements.txtpip install -r requirements-dev.txtFor enhanced functionality, install optional packages:
pip install psutil GPUtil PyYAMLRun the full interactive experience:
python main.py interactiveCheck your system capabilities:
python main.py hardwareBrowse the model database:
python main.py models
python main.py models --model-id qwen2.5 # Show specific model detailsGet recommendations with specific parameters:
python main.py recommend --use-case code --context-importance 3 --toolsClear hardware detection cache:
python main.py clear-cachemodel_selector/hardware.py: Async hardware detection with cachingmodel_selector/models.py: Model management and recommendation enginemodel_selector/selector.py: Rich CLI interface with user interactionmain.py: CLI entry point with Click framework
models.json: External model database (easily updatable)~/.model-selector/config.json: User preferences persistence~/.model-selector/hardware_cache.json: Hardware detection cache
The assistant optimizes recommendations for various scenarios:
- RAG (Retrieval-Augmented Generation): Includes embedding model requirements
- Programming Assistant: Prioritizes code generation capabilities
- Conversational Chatbot: Focuses on language and reasoning skills
- Document Analysis: Emphasizes reasoning and knowledge capabilities
- Multilingual Tasks: Considers language support breadth
- Education/Tutoring: Highlights math and reasoning abilities
- Creative Writing: Prioritizes language generation quality
- General Use: Balanced scoring across all capabilities
pytest # Run all tests
pytest tests/test_hardware.py -v # Test hardware detection
pytest tests/test_models.py -v # Test model management
pytest --cov=model_selector # With coverageblack model_selector/ # Format code
flake8 model_selector/ # Lint code
mypy model_selector/ # Type checkingUpdate the models.json file with new model specifications:
{
"models": {
"new_model": {
"base_name": "New Model",
"variants": {
"7B-Q4_K_M": {"params": "7B", "quant": "Q4_K_M", "vram": 4.5, "ram": 6.0}
},
"context": 8000,
"scores": {"knowledge": 4, "math": 3, "code": 4, "reasoning": 4, "language": 4},
"tools": true,
"languages": ["English"],
"docker": "ai/new-model"
}
}
}- Linux: Reads
/proc/cpuinfofor detailed CPU information - macOS: Uses
sysctlfor CPU brand and core count - Windows: Platform-specific detection with fallbacks
- NVIDIA: Uses
nvidia-smiand optionalGPUtillibrary - AMD: Uses
rocm-smion Linux systems - Apple Silicon: Detects M1/M2/M3/M4 chips with unified memory
- Intel Mac: Detects discrete GPUs via
system_profiler
- Primary: Uses
psutilfor accurate memory detection - Fallback: Platform-specific methods for systems without psutil
- Smart Allocation: Reserves memory for system processes
The application includes a comprehensive database of popular AI models:
- SmolLM2: Ultra-lightweight models (135M-360M parameters)
- Gemma3: Multimodal capabilities (1B-4B parameters)
- Llama 3.2: Meta's latest models (1B-3B parameters)
- Qwen2.5: Multilingual excellence (0.5B-7B parameters)
- Qwen3: Latest with thinking modes (0.6B-14B parameters)
- Mistral: Reasoning-focused models (7B-12B parameters)
- Phi4: Microsoft's efficient models (14B parameters)
- DeepSeek-R1: Reasoning-optimized models (8B-70B parameters)
- QwQ: Agent-capable models (32B parameters)
Each model includes:
- Multiple quantization options (F16, Q8_0, Q6_K, Q4_K_M, Q4_0, Q2_K)
- Memory requirements for both VRAM and RAM
- Capability scores across different domains
- Context length specifications
- Tool calling support
- Language support information
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Run the test suite
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Hardware detection inspired by various system monitoring tools
- Model specifications gathered from official documentation
- CLI interface built with the excellent Rich library
- Async programming patterns for improved performance