{"id":13443363,"url":"https://github.com/open-mmlab/mim","last_synced_at":"2025-05-15T22:06:55.717Z","repository":{"id":37704857,"uuid":"368863338","full_name":"open-mmlab/mim","owner":"open-mmlab","description":"MIM Installs OpenMMLab Packages","archived":false,"fork":false,"pushed_at":"2023-11-24T02:24:59.000Z","size":777,"stargazers_count":363,"open_issues_count":42,"forks_count":67,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-08T08:17:52.774Z","etag":null,"topics":["mim","openmmlab"],"latest_commit_sha":null,"homepage":"https://openmim.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/open-mmlab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-05-19T12:35:18.000Z","updated_at":"2025-04-05T17:59:15.000Z","dependencies_parsed_at":"2023-10-21T12:38:05.622Z","dependency_job_id":"9cb4f941-95a7-412e-8c82-6f849c2ac454","html_url":"https://github.com/open-mmlab/mim","commit_stats":{"total_commits":155,"total_committers":25,"mean_commits":6.2,"dds":0.6387096774193548,"last_synced_commit":"5d54183ef90a44eb5dee167cdd614848d92938f4"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-mmlab%2Fmim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-mmlab%2Fmim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-mmlab%2Fmim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-mmlab%2Fmim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/open-mmlab","download_url":"https://codeload.github.com/open-mmlab/mim/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254430330,"owners_count":22069909,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mim","openmmlab"],"created_at":"2024-07-31T03:01:59.694Z","updated_at":"2025-05-15T22:06:55.667Z","avatar_url":"https://github.com/open-mmlab.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# MIM: MIM Installs OpenMMLab Packages\n\nMIM provides a unified interface for launching and installing OpenMMLab projects and their extensions, and managing the OpenMMLab model zoo.\n\n## Major Features\n\n- **Package Management**\n\n  You can use MIM to manage OpenMMLab codebases, install or uninstall them conveniently.\n\n- **Model Management**\n\n  You can use MIM to manage OpenMMLab model zoo, e.g., download checkpoints by name, search checkpoints that meet specific criteria.\n\n- **Unified Entrypoint for Scripts**\n\n  You can execute any script provided by all OpenMMLab codebases with unified commands. Train, test and inference become easier than ever. Besides, you can use `gridsearch` command for vanilla hyper-parameter search.\n\n## License\n\nThis project is released under the [Apache 2.0 license](LICENSE).\n\n## Changelog\n\nv0.1.1 was released in 13/6/2021.\n\n## Customization\n\nYou can use `.mimrc` for customization. Now we support customize default values of each sub-command. Please refer to [customization.md](docs/en/customization.md) for details.\n\n## Build custom projects with MIM\n\nWe provide some examples of how to build custom projects based on OpenMMLAB codebases and MIM in [MIM-Example](https://github.com/open-mmlab/mim-example).\nWithout worrying about copying codes and scripts from existing codebases, users can focus on developing new components and MIM helps integrate and run the new project.\n\n## Installation\n\nPlease refer to [installation.md](docs/en/installation.md) for installation.\n\n## Command\n\n\u003cdetails\u003e\n\u003csummary\u003e1. install\u003c/summary\u003e\n\n- command\n\n  ```bash\n  # install latest version of mmcv-full\n  \u003e mim install mmcv-full  # wheel\n  # install 1.5.0\n  \u003e mim install mmcv-full==1.5.0\n\n  # install latest version of mmcls\n  \u003e mim install mmcls\n  # install master branch\n  \u003e mim install git+https://github.com/open-mmlab/mmclassification.git\n  # install local repo\n  \u003e git clone https://github.com/open-mmlab/mmclassification.git\n  \u003e cd mmclassification\n  \u003e mim install .\n\n  # install extension based on OpenMMLab\n  mim install git+https://github.com/xxx/mmcls-project.git\n  ```\n\n- api\n\n  ```python\n  from mim import install\n\n  # install mmcv\n  install('mmcv-full')\n\n  # install mmcls will automatically install mmcv if it is not installed\n  install('mmcls')\n\n  # install extension based on OpenMMLab\n  install('git+https://github.com/xxx/mmcls-project.git')\n  ```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e2. uninstall\u003c/summary\u003e\n\n- command\n\n  ```bash\n  # uninstall mmcv\n  \u003e mim uninstall mmcv-full\n\n  # uninstall mmcls\n  \u003e mim uninstall mmcls\n  ```\n\n- api\n\n  ```python\n  from mim import uninstall\n\n  # uninstall mmcv\n  uninstall('mmcv-full')\n\n  # uninstall mmcls\n  uninstall('mmcls')\n  ```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e3. list\u003c/summary\u003e\n\n- command\n\n  ```bash\n  \u003e mim list\n  \u003e mim list --all\n  ```\n\n- api\n\n  ```python\n  from mim import list_package\n\n  list_package()\n  list_package(True)\n  ```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e4. search\u003c/summary\u003e\n\n- command\n\n  ```bash\n  \u003e mim search mmcls\n  \u003e mim search mmcls==0.23.0 --remote\n  \u003e mim search mmcls --config resnet18_8xb16_cifar10\n  \u003e mim search mmcls --model resnet\n  \u003e mim search mmcls --dataset cifar-10\n  \u003e mim search mmcls --valid-field\n  \u003e mim search mmcls --condition 'batch_size\u003e45,epochs\u003e100'\n  \u003e mim search mmcls --condition 'batch_size\u003e45 epochs\u003e100'\n  \u003e mim search mmcls --condition '128\u003cbatch_size\u003c=256'\n  \u003e mim search mmcls --sort batch_size epochs\n  \u003e mim search mmcls --field epochs batch_size weight\n  \u003e mim search mmcls --exclude-field weight paper\n  ```\n\n- api\n\n  ```python\n  from mim import get_model_info\n\n  get_model_info('mmcls')\n  get_model_info('mmcls==0.23.0', local=False)\n  get_model_info('mmcls', models=['resnet'])\n  get_model_info('mmcls', training_datasets=['cifar-10'])\n  get_model_info('mmcls', filter_conditions='batch_size\u003e45,epochs\u003e100')\n  get_model_info('mmcls', filter_conditions='batch_size\u003e45 epochs\u003e100')\n  get_model_info('mmcls', filter_conditions='128\u003cbatch_size\u003c=256')\n  get_model_info('mmcls', sorted_fields=['batch_size', 'epochs'])\n  get_model_info('mmcls', shown_fields=['epochs', 'batch_size', 'weight'])\n  ```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e5. download\u003c/summary\u003e\n\n- command\n\n  ```bash\n  \u003e mim download mmcls --config resnet18_8xb16_cifar10\n  \u003e mim download mmcls --config resnet18_8xb16_cifar10 --dest .\n  ```\n\n- api\n\n  ```python\n  from mim import download\n\n  download('mmcls', ['resnet18_8xb16_cifar10'])\n  download('mmcls', ['resnet18_8xb16_cifar10'], dest_root='.')\n  ```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e6. train\u003c/summary\u003e\n\n- command\n\n  ```bash\n  # Train models on a single server with CPU by setting `gpus` to 0 and\n  # 'launcher' to 'none' (if applicable). The training script of the\n  # corresponding codebase will fail if it doesn't support CPU training.\n  \u003e mim train mmcls resnet101_b16x8_cifar10.py --work-dir tmp --gpus 0\n  # Train models on a single server with one GPU\n  \u003e mim train mmcls resnet101_b16x8_cifar10.py --work-dir tmp --gpus 1\n  # Train models on a single server with 4 GPUs and pytorch distributed\n  \u003e mim train mmcls resnet101_b16x8_cifar10.py --work-dir tmp --gpus 4 \\\n      --launcher pytorch\n  # Train models on a slurm HPC with one 8-GPU node\n  \u003e mim train mmcls resnet101_b16x8_cifar10.py --launcher slurm --gpus 8 \\\n      --gpus-per-node 8 --partition partition_name --work-dir tmp\n  # Print help messages of sub-command train\n  \u003e mim train -h\n  # Print help messages of sub-command train and the training script of mmcls\n  \u003e mim train mmcls -h\n  ```\n\n- api\n\n  ```python\n  from mim import train\n\n  train(repo='mmcls', config='resnet18_8xb16_cifar10.py', gpus=0,\n        other_args=('--work-dir', 'tmp'))\n  train(repo='mmcls', config='resnet18_8xb16_cifar10.py', gpus=1,\n        other_args=('--work-dir', 'tmp'))\n  train(repo='mmcls', config='resnet18_8xb16_cifar10.py', gpus=4,\n        launcher='pytorch', other_args=('--work-dir', 'tmp'))\n  train(repo='mmcls', config='resnet18_8xb16_cifar10.py', gpus=8,\n        launcher='slurm', gpus_per_node=8, partition='partition_name',\n        other_args=('--work-dir', 'tmp'))\n  ```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e7. test\u003c/summary\u003e\n\n- command\n\n  ```bash\n  # Test models on a single server with 1 GPU, report accuracy\n  \u003e mim test mmcls resnet101_b16x8_cifar10.py --checkpoint \\\n      tmp/epoch_3.pth --gpus 1 --metrics accuracy\n  # Test models on a single server with 1 GPU, save predictions\n  \u003e mim test mmcls resnet101_b16x8_cifar10.py --checkpoint \\\n      tmp/epoch_3.pth --gpus 1 --out tmp.pkl\n  # Test models on a single server with 4 GPUs, pytorch distributed,\n  # report accuracy\n  \u003e mim test mmcls resnet101_b16x8_cifar10.py --checkpoint \\\n      tmp/epoch_3.pth --gpus 4 --launcher pytorch --metrics accuracy\n  # Test models on a slurm HPC with one 8-GPU node, report accuracy\n  \u003e mim test mmcls resnet101_b16x8_cifar10.py --checkpoint \\\n      tmp/epoch_3.pth --gpus 8 --metrics accuracy --partition \\\n      partition_name --gpus-per-node 8 --launcher slurm\n  # Print help messages of sub-command test\n  \u003e mim test -h\n  # Print help messages of sub-command test and the testing script of mmcls\n  \u003e mim test mmcls -h\n  ```\n\n- api\n\n  ```python\n  from mim import test\n  test(repo='mmcls', config='resnet101_b16x8_cifar10.py',\n       checkpoint='tmp/epoch_3.pth', gpus=1, other_args=('--metrics', 'accuracy'))\n  test(repo='mmcls', config='resnet101_b16x8_cifar10.py',\n       checkpoint='tmp/epoch_3.pth', gpus=1, other_args=('--out', 'tmp.pkl'))\n  test(repo='mmcls', config='resnet101_b16x8_cifar10.py',\n       checkpoint='tmp/epoch_3.pth', gpus=4, launcher='pytorch',\n       other_args=('--metrics', 'accuracy'))\n  test(repo='mmcls', config='resnet101_b16x8_cifar10.py',\n       checkpoint='tmp/epoch_3.pth', gpus=8, partition='partition_name',\n       launcher='slurm', gpus_per_node=8, other_args=('--metrics', 'accuracy'))\n  ```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e8. run\u003c/summary\u003e\n\n- command\n\n  ```bash\n  # Get the Flops of a model\n  \u003e mim run mmcls get_flops resnet101_b16x8_cifar10.py\n  # Publish a model\n  \u003e mim run mmcls publish_model input.pth output.pth\n  # Train models on a slurm HPC with one GPU\n  \u003e srun -p partition --gres=gpu:1 mim run mmcls train \\\n      resnet101_b16x8_cifar10.py --work-dir tmp\n  # Test models on a slurm HPC with one GPU, report accuracy\n  \u003e srun -p partition --gres=gpu:1 mim run mmcls test \\\n      resnet101_b16x8_cifar10.py tmp/epoch_3.pth --metrics accuracy\n  # Print help messages of sub-command run\n  \u003e mim run -h\n  # Print help messages of sub-command run, list all available scripts in\n  # codebase mmcls\n  \u003e mim run mmcls -h\n  # Print help messages of sub-command run, print the help message of\n  # training script in mmcls\n  \u003e mim run mmcls train -h\n  ```\n\n- api\n\n  ```python\n  from mim import run\n\n  run(repo='mmcls', command='get_flops',\n      other_args=('resnet101_b16x8_cifar10.py',))\n  run(repo='mmcls', command='publish_model',\n      other_args=('input.pth', 'output.pth'))\n  run(repo='mmcls', command='train',\n      other_args=('resnet101_b16x8_cifar10.py', '--work-dir', 'tmp'))\n  run(repo='mmcls', command='test',\n      other_args=('resnet101_b16x8_cifar10.py', 'tmp/epoch_3.pth', '--metrics accuracy'))\n  ```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e9. gridsearch\u003c/summary\u003e\n\n- command\n\n  ```bash\n  # Parameter search on a single server with CPU by setting `gpus` to 0 and\n  # 'launcher' to 'none' (if applicable). The training script of the\n  # corresponding codebase will fail if it doesn't support CPU training.\n  \u003e mim gridsearch mmcls resnet101_b16x8_cifar10.py --work-dir tmp --gpus 0 \\\n      --search-args '--optimizer.lr 1e-2 1e-3'\n  # Parameter search with on a single server with one GPU, search learning\n  # rate\n  \u003e mim gridsearch mmcls resnet101_b16x8_cifar10.py --work-dir tmp --gpus 1 \\\n      --search-args '--optimizer.lr 1e-2 1e-3'\n  # Parameter search with on a single server with one GPU, search\n  # weight_decay\n  \u003e mim gridsearch mmcls resnet101_b16x8_cifar10.py --work-dir tmp --gpus 1 \\\n      --search-args '--optimizer.weight_decay 1e-3 1e-4'\n  # Parameter search with on a single server with one GPU, search learning\n  # rate and weight_decay\n  \u003e mim gridsearch mmcls resnet101_b16x8_cifar10.py --work-dir tmp --gpus 1 \\\n      --search-args '--optimizer.lr 1e-2 1e-3 --optimizer.weight_decay 1e-3 \\\n      1e-4'\n  # Parameter search on a slurm HPC with one 8-GPU node, search learning\n  # rate and weight_decay\n  \u003e mim gridsearch mmcls resnet101_b16x8_cifar10.py --work-dir tmp --gpus 8 \\\n      --partition partition_name --gpus-per-node 8 --launcher slurm \\\n      --search-args '--optimizer.lr 1e-2 1e-3 --optimizer.weight_decay 1e-3 \\\n      1e-4'\n  # Parameter search on a slurm HPC with one 8-GPU node, search learning\n  # rate and weight_decay, max parallel jobs is 2\n  \u003e mim gridsearch mmcls resnet101_b16x8_cifar10.py --work-dir tmp --gpus 8 \\\n      --partition partition_name --gpus-per-node 8 --launcher slurm \\\n      --max-jobs 2 --search-args '--optimizer.lr 1e-2 1e-3 \\\n      --optimizer.weight_decay 1e-3 1e-4'\n  # Print the help message of sub-command search\n  \u003e mim gridsearch -h\n  # Print the help message of sub-command search and the help message of the\n  # training script of codebase mmcls\n  \u003e mim gridsearch mmcls -h\n  ```\n\n- api\n\n  ```python\n  from mim import gridsearch\n\n  gridsearch(repo='mmcls', config='resnet101_b16x8_cifar10.py', gpus=0,\n             search_args='--optimizer.lr 1e-2 1e-3',\n             other_args=('--work-dir', 'tmp'))\n  gridsearch(repo='mmcls', config='resnet101_b16x8_cifar10.py', gpus=1,\n             search_args='--optimizer.lr 1e-2 1e-3',\n             other_args=('--work-dir', 'tmp'))\n  gridsearch(repo='mmcls', config='resnet101_b16x8_cifar10.py', gpus=1,\n             search_args='--optimizer.weight_decay 1e-3 1e-4',\n             other_args=('--work-dir', 'tmp'))\n  gridsearch(repo='mmcls', config='resnet101_b16x8_cifar10.py', gpus=1,\n             search_args='--optimizer.lr 1e-2 1e-3 --optimizer.weight_decay'\n                         '1e-3 1e-4',\n             other_args=('--work-dir', 'tmp'))\n  gridsearch(repo='mmcls', config='resnet101_b16x8_cifar10.py', gpus=8,\n             partition='partition_name', gpus_per_node=8, launcher='slurm',\n             search_args='--optimizer.lr 1e-2 1e-3 --optimizer.weight_decay'\n                         ' 1e-3 1e-4',\n             other_args=('--work-dir', 'tmp'))\n  gridsearch(repo='mmcls', config='resnet101_b16x8_cifar10.py', gpus=8,\n             partition='partition_name', gpus_per_node=8, launcher='slurm',\n             max_workers=2,\n             search_args='--optimizer.lr 1e-2 1e-3 --optimizer.weight_decay'\n                         ' 1e-3 1e-4',\n             other_args=('--work-dir', 'tmp'))\n  ```\n\n\u003c/details\u003e\n\n## Contributing\n\nWe appreciate all contributions to improve mim. Please refer to [CONTRIBUTING.md](https://github.com/open-mmlab/mmcv/blob/master/CONTRIBUTING.md) for the contributing guideline.\n\n## License\n\nThis project is released under the [Apache 2.0 license](LICENSE).\n\n## Projects in OpenMMLab\n\n- [MMEngine](https://github.com/open-mmlab/mmengine): OpenMMLab foundational library for training deep learning models.\n- [MMCV](https://github.com/open-mmlab/mmcv): OpenMMLab foundational library for computer vision.\n- [MMEval](https://github.com/open-mmlab/mmeval): A unified evaluation library for multiple machine learning libraries.\n- [MMPreTrain](https://github.com/open-mmlab/mmpretrain): OpenMMLab pre-training toolbox and benchmark.\n- [MMagic](https://github.com/open-mmlab/mmagic): Open**MM**Lab **A**dvanced, **G**enerative and **I**ntelligent **C**reation toolbox.\n- [MMDetection](https://github.com/open-mmlab/mmdetection): OpenMMLab detection toolbox and benchmark.\n- [MMYOLO](https://github.com/open-mmlab/mmyolo): OpenMMLab YOLO series toolbox and benchmark.\n- [MMDetection3D](https://github.com/open-mmlab/mmdetection3d): OpenMMLab's next-generation platform for general 3D object detection.\n- [MMRotate](https://github.com/open-mmlab/mmrotate): OpenMMLab rotated object detection toolbox and benchmark.\n- [MMTracking](https://github.com/open-mmlab/mmtracking): OpenMMLab video perception toolbox and benchmark.\n- [MMPose](https://github.com/open-mmlab/mmpose): OpenMMLab pose estimation toolbox and benchmark.\n- [MMSegmentation](https://github.com/open-mmlab/mmsegmentation): OpenMMLab semantic segmentation toolbox and benchmark.\n- [MMOCR](https://github.com/open-mmlab/mmocr): OpenMMLab text detection, recognition, and understanding toolbox.\n- [MMHuman3D](https://github.com/open-mmlab/mmhuman3d): OpenMMLab 3D human parametric model toolbox and benchmark.\n- [MMSelfSup](https://github.com/open-mmlab/mmselfsup): OpenMMLab self-supervised learning toolbox and benchmark.\n- [MMFewShot](https://github.com/open-mmlab/mmfewshot): OpenMMLab fewshot learning toolbox and benchmark.\n- [MMAction2](https://github.com/open-mmlab/mmaction2): OpenMMLab's next-generation action understanding toolbox and benchmark.\n- [MMFlow](https://github.com/open-mmlab/mmflow): OpenMMLab optical flow toolbox and benchmark.\n- [MMDeploy](https://github.com/open-mmlab/mmdeploy): OpenMMLab model deployment framework.\n- [MMRazor](https://github.com/open-mmlab/mmrazor): OpenMMLab model compression toolbox and benchmark.\n- [Playground](https://github.com/open-mmlab/playground): A central hub for gathering and showcasing amazing projects built upon OpenMMLab.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-mmlab%2Fmim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopen-mmlab%2Fmim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-mmlab%2Fmim/lists"}