{"id":5324,"library":"mmengine","title":"MMEngine","description":"MMEngine is the foundational training engine for OpenMMLab projects, providing a comprehensive and flexible framework for deep learning training, evaluation, and deployment. It offers utilities for configuration management, logging, hooks, runners, and visualization. The current stable version is 0.10.7, with frequent patch and minor releases and active development towards 0.11.0.","status":"active","version":"0.10.7","language":"en","source_language":"en","source_url":"https://github.com/open-mmlab/mmengine","tags":["machine learning","deep learning","training framework","computer vision","openmmlab","pytorch"],"install":[{"cmd":"pip install mmengine","lang":"bash","label":"Stable release"}],"dependencies":[{"reason":"MMEngine is primarily used for PyTorch-based deep learning tasks. While not a strict core dependency, it's almost always required for practical use.","package":"torch","optional":true},{"reason":"Used for image processing utilities. Starting from v0.11.0, this becomes the default OpenCV variant for MMEngine.","package":"opencv-python-headless","optional":true}],"imports":[{"symbol":"Config","correct":"from mmengine.config import Config"},{"note":"For OpenMMLab V1.0+, Runner functionality migrated from MMCV to MMEngine.","wrong":"from mmcv.runner import Runner","symbol":"Runner","correct":"from mmengine.runner import Runner"},{"symbol":"LoggerHook","correct":"from mmengine.hooks import LoggerHook"},{"symbol":"Visualizer","correct":"from mmengine.visualization import Visualizer"},{"note":"Registry for datasets, similar patterns for MODELS, OPTIMIZERS, etc.","symbol":"DATASETS","correct":"from mmengine.registry import DATASETS"}],"quickstart":{"code":"from mmengine.config import Config\n\n# Define configuration using a dictionary\ncfg_dict = dict(\n    model=dict(type='MyCustomModel', num_classes=10, init_cfg=None),\n    dataloader=dict(batch_size=32, num_workers=4),\n    optimizer=dict(type='Adam', lr=0.001)\n)\n\n# Create a Config object\ncfg = Config(cfg_dict)\n\n# Access configuration parameters\nprint(f\"Model type: {cfg.model.type}\")\nprint(f\"Optimizer learning rate: {cfg.optimizer.lr}\")\n\n# You can also load from a file:\n# cfg = Config.fromfile('path/to/your_config.py')\n","lang":"python","description":"This quickstart demonstrates how to define and use a configuration object in MMEngine. The `Config` class is central to managing experiment settings, model architectures, and training parameters, often loaded from Python files."},"warnings":[{"fix":"Refer to the MMEngine migration guides and the documentation for specific OpenMMLab projects (e.g., MMDetection V3.x, MMSegmentation V1.x) for updated API usage.","message":"Major API refactor for OpenMMLab V1.0 projects. If migrating from older OpenMMLab frameworks (e.g., using `mmcv.runner`), significant code changes are required as MMEngine unifies the core engine components.","severity":"breaking","affected_versions":"Prior to OpenMMLab V1.0 frameworks (e.g., before MMEngine v0.1.0) to current."},{"fix":"Familiarize yourself with the MMEngine Config tutorial. Ensure components are correctly registered and paths for inherited configs are resolved properly.","message":"MMEngine's Config system uses Python files (`.py`) for configurations, allowing for complex logic and inheritance. This differs from older YAML/JSON configurations. Misunderstanding the inheritance mechanism or how `register_module` works can lead to errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Install necessary optional dependencies explicitly (e.g., `pip install 'mmengine[tensorboard]'`). Check the MMEngine installation guide for specific extras.","message":"Many advanced features, optimizers, and visualization backends (e.g., MLflow, TensorBoard, specific deepspeed optimizers) are optional dependencies. Attempting to use them without prior installation will result in `ImportError`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If GUI features are needed, explicitly install `opencv-python` alongside `mmengine` and ensure it takes precedence if multiple `opencv` packages are present.","message":"Starting from v0.11.0, MMEngine will default to using `opencv-python-headless` for image processing. If your workflow relies on `opencv-python` with GUI functionalities, ensure it's explicitly installed and managed.","severity":"gotcha","affected_versions":"v0.11.0 and later (currently in RC)"},{"fix":"Upgrade MMEngine to v0.11.0rc0 or later if using Python 3.12, or use a Python version officially supported by your MMEngine version.","message":"Versions prior to v0.11.0rc0 may encounter bugs related to config parsing when running on Python 3.12.","severity":"gotcha","affected_versions":"Prior to v0.11.0rc0"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}