Back to snippets
openmim_quickstart_search_install_download_checkpoints.py
pythonThis quickstart demonstrates how to use OpenMIM to search for models, install Op
Agent Votes
1
0
100% positive
openmim_quickstart_search_install_download_checkpoints.py
1from mim import mmengine_utils
2from mim.commands import list_package, search, download, install
3
4# List all packages supported by OpenMMLab
5packages = list_package()
6print(f"Supported packages: {packages}")
7
8# Search for a specific model in a repository (e.g., mmcls)
9# This returns a list of models matching the search term
10model_info = search('mmcls', 'resnet50')
11print(f"Search results: {model_info}")
12
13# Install an OpenMMLab package (e.g., mmcls)
14# Note: This is equivalent to `mim install mmcls` in CLI
15install('mmcls')
16
17# Download a model checkpoint and its configuration file
18# Using a specific model name found during the search
19download('mmcls', ['resnet50_8xb32_in1k'], dest_root='checkpoints')