How deci-ai/super-gradients works
Main Components
• Core Library & Common Modules: This covers “src/super_gradients/common” and its submodules (data types, environment, AWS/data connectors, logging, decorators, etc.). Mark these as foundational utilities that support the whole framework.
• Model Zoo and Architectures: Around “src/super_gradients/training/models” and “src/super_gradients/recipes” – these components define various classification, segmentation, detection, and pose estimation models along with predefined recipes (YoloNAS, DEKR, etc.).
• Training Pipeline: Include the training modules (located in “src/super_gradients/training”) that include dataloaders, datasets, loss functions, metrics, optimizers, callbacks, and pipelines. The Trainer and scripts like “train_from_recipe.py” reside here.
• Conversion and Inference: The “src/super_gradients/conversion” and “src/super_gradients/inference” modules handle the conversion (exporting to ONNX, TensorRT, etc.) as well as inference logic.
• Integration and Plugins: Highlight integration with external services/loggers (WandB, ClearML, DagsHub) as well as utility plugins. These can be represented as distinct connectors that interact with the training module.
• Testing & Documentation: Although not part of the runtime architecture, having a robust “tests” directory and “documentation” folder helps indicate that the system design places strong emphasis on modularity, reproducibility, and validation. These can be shown as supporting components.
Relationships and Data Flow
• The Trainer (from the training module) orchestrates the entire training lifecycle—interacting with:
• The Model Factory (in “models” or “factories”) that instantiates a given architecture from the Model Zoo or recipe.
• Data interfaces/dataloaders pulling data from various datasets (found in “training/datasets”).
• Callback and logging modules that interface with external plugins (wandb, clearml, etc.) for tracking the training progress.
• Before and after training, conversion utilities and inference modules transform trained models to production-ready formats.
• The recipes provide configuration and override default training parameters so that the same model can be easily adapted for fine-tuning or transfer learning.
• The common utilities provide shared services such as distributed training support (DDP), environment setup, and error handling that pervade the system.
Architectural Patterns and Design Principles
• Modular & Layered Architecture: The system is built as independent modules (common utilities, training, models, conversion) that interact through well-defined interfaces.
• Factory and Callback Patterns: Factories for model instantiation and extensive use of callbacks (phase callbacks, logging, learning rate scheduling) to decouple the training workflow.
• Extensibility: The use of registries and plugin integration allows easy extension to new model architectures, losses, datasets, and logging services.
• Production Readiness: Integration with model conversion (to ONNX/TensorRT) and deployment pipelines, along with distributed training support, makes the system suitable for production.