MIM (OpenMMLab Install Manager)

0.3.10 · active · verified Sun Apr 12

MIM is the official command-line utility for managing OpenMMLab packages. It simplifies the installation of complex deep learning libraries, especially those with specific CUDA and PyTorch dependencies, by providing a unified interface for installation, downloading models, and dataset management. It aims to reduce common installation pitfalls for OpenMMLab projects. The current version is 0.3.10, and it generally releases new versions every 1-2 months.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use `openmim` programmatically to install an OpenMMLab package (like `mmcv-full`) and download a pretrained model configuration. `mim` handles complex dependencies, including CUDA toolkits for `mmcv-full`. The `python -m mim` invocation is used to ensure compatibility with the current Python environment.

import subprocess
import sys

# Install a core OpenMMLab package, e.g., mmcv-full (with CUDA support)
print('Installing mmcv-full using mim...')
install_cmd = [sys.executable, '-m', 'mim', 'install', 'mmcv-full']
result = subprocess.run(install_cmd, capture_output=True, text=True)
print('STDOUT:', result.stdout)
print('STDERR:', result.stderr)
if result.returncode == 0:
    print('mmcv-full installed successfully.')
else:
    print('Failed to install mmcv-full.')
    
# You can also download a pretrained model
print('\nDownloading a MMYOLO model using mim...')
download_cmd = [sys.executable, '-m', 'mim', 'download', 'mmyolo', '--config', 'yolov8_s_syncbn_fast_8xb16-500e_coco', '--dest', '.']
result = subprocess.run(download_cmd, capture_output=True, text=True)
print('STDOUT:', result.stdout)
print('STDERR:', result.stderr)
if result.returncode == 0:
    print('Model downloaded successfully.')
else:
    print('Failed to download model.')

view raw JSON →