MMEngine is a foundational library for training deep learning models based on PyTorch. It supports running on Linux, Windows, and macOS. It has the following three features:
Universal and powerful executor:
Supports training different tasks with minimal code, such as training ImageNet with just 80 lines of code (original PyTorch examples require 400 lines).
Easily compatible with models from popular algorithm libraries like TIMM, TorchVision, and Detectron2.
Open architecture with unified interfaces:
Handles different tasks with a unified API: you can implement a method once and apply it to all compatible models.
Supports various backend devices through a simple, high-level abstraction. Currently, MMEngine supports model training on Nvidia CUDA, Mac MPS, AMD, MLU, and other devices.
Customizable training process:
Defines a highly modular training engine with “Lego”-like composability.
Offers a rich set of components and strategies.
Total control over the training process with different levels of APIs.
The above diagram illustrates the hierarchy of MMEngine in OpenMMLab 2.0. MMEngine implements a next-generation training architecture for the OpenMMLab algorithm library, providing a unified execution foundation for over 30 algorithm libraries within OpenMMLab. Its core components include the training engine, evaluation engine, and module management.
MMEngine abstracts the components involved in the training process and their relationships. Components of the same type in different algorithm libraries share the same interface definition.
Common Base Modules¶
MMEngine also implements various common base modules required during the execution of algorithmic models, including:
Config: In the OpenMMLab algorithm library, users can configure the training, testing process, and related components by writing a configuration file (config).
Registry: Responsible for managing modules within the algorithm library that have similar functionality. Based on the abstraction of algorithm library modules, MMEngine defines a set of root registries. Registries within the algorithm library can inherit from these root registries, enabling cross-algorithm library module invocations and interactions. This allows for seamless integration and utilization of modules across different algorithms within the OpenMMLab framework.
File I/O: Provides a unified interface for file read/write operations in various modules, supporting multiple file backend systems and formats in a consistent manner, with extensibility.
Distributed Communication Primitives: Handles communication between different processes during distributed program execution. This interface abstracts the differences between distributed and non-distributed environments and automatically handles data devices and communication backends.
Other Utilities: There are also utility modules, such as
ManagerMixin, which implements a way to create and access global variables. The base class for many globally accessible objects within the
Users can further read the tutorials to understand the advanced usage of these modules or refer to the design documents to understand their design principles and details.