{"library":"model-index","title":"Papers with Code Model Index","description":"The model-index library helps machine learning researchers and engineers maintain a single source of truth for their ML model metadata. It allows storing metadata flexibly in JSONs, YAMLs, or markdown annotations, and enables browsing and comparing models on Papers with Code. The library is currently at version 0.1.11 and appears to have an active, though not rapid, release cadence.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install model-index"],"cli":null},"imports":["from modelindex.models import ModelIndex"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nfrom pathlib import Path\nfrom modelindex.models import ModelIndex\n\n# 1. Create a dummy model-index.yml file for demonstration\nmodel_index_content = '''\nModels:\n  - Name: MyAwesomeModelV1\n    Metadata:\n      Task: Image Classification\n      Dataset: CIFAR-10\n      Metrics:\n        Accuracy: 0.92\n      Paper: https://arxiv.org/abs/2301.00001\n      Code: https://github.com/myuser/myawesomemodel\n      Weights: https://example.com/weights.pth\n      License: MIT\n  - Name: MyAwesomeModelV2\n    Metadata:\n      Task: Image Classification\n      Dataset: CIFAR-10\n      Metrics:\n        Accuracy: 0.94\n      Paper: https://arxiv.org/abs/2302.00002\n      Code: https://github.com/myuser/myawesomemodel\n      Weights: https://example.com/weights_v2.pth\n      License: Apache-2.0\n'''\n\nindex_file_path = \"model-index.yml\"\nPath(index_file_path).write_text(model_index_content)\n\nprint(f\"Created dummy {index_file_path}\")\n\ntry:\n    # 2. Load the model index from the YAML file\n    # Note: The exact loading method might vary; .load_from_file() is a common pattern.\n    # The library's core is parsing these files.\n    model_index = ModelIndex.load_from_file(index_file_path)\n\n    print(f\"\\nSuccessfully loaded {len(model_index.models)} model(s).\")\n\n    # 3. Access data from the loaded index\n    for i, model in enumerate(model_index.models):\n        print(f\"\\n--- Model {i+1} ---\")\n        print(f\"Name: {model.name}\")\n        print(f\"Task: {model.metadata['Task']}\")\n        print(f\"Accuracy: {model.metadata['Metrics']['Accuracy']}\")\n        print(f\"Paper: {model.metadata['Paper']}\")\n\nexcept Exception as e:\n    print(f\"An error occurred during loading or processing: {e}\")\nfinally:\n    # Clean up the dummy file\n    if Path(index_file_path).exists():\n        os.remove(index_file_path)\n        print(f\"\\nCleaned up {index_file_path}\")\n","lang":"python","description":"This quickstart demonstrates how to define a `model-index.yml` file and then programmatically load and inspect its contents using the `model-index` Python library. It highlights how the library facilitates reading structured model metadata into Python objects.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":"0.1.11","pypi_latest":"0.1.11","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.9,"avg_import_s":0.33,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"model-index","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.28,"mem_mb":6.7,"disk_size":"21.9M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"model-index","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.8,"import_time_s":0.22,"mem_mb":6.7,"disk_size":"23M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"model-index","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.46,"mem_mb":7,"disk_size":"24.3M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"model-index","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.9,"import_time_s":0.42,"mem_mb":7,"disk_size":"26M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"model-index","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.34,"mem_mb":7,"disk_size":"16.1M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"model-index","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.9,"import_time_s":0.4,"mem_mb":7,"disk_size":"17M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"model-index","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.33,"mem_mb":7.2,"disk_size":"15.9M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"model-index","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.8,"import_time_s":0.39,"mem_mb":7,"disk_size":"17M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"model-index","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.22,"mem_mb":6.7,"disk_size":"21.6M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"model-index","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.3,"import_time_s":0.24,"mem_mb":6.7,"disk_size":"23M"}]}}