)]}'
{
  "commit": "ab3c9bb031f82f8481da7d867fab03db9180646a",
  "tree": "143d7fd2c5edbd5a9b572df9d67b7c558afd703f",
  "parents": [
    "c62c3d00583a91d82f4f15c89d97d525b2d2c529"
  ],
  "author": {
    "name": "zjgarvey",
    "email": "47986913+zjgarvey@users.noreply.github.com",
    "time": "Mon Dec 09 16:07:13 2024 -0600"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Mon Dec 09 16:07:13 2024 -0600"
  },
  "message": "[iree-import-onnx] improve handling of large models (#19217)\n\nThis pr adds a few options:\r\n\r\n1. `--large-model` allows disabling the onnx model checker if a user\r\nknows ahead of time that the model is too large. It will also not load\r\nthe external weights in memory unless saving the parameters.\r\n2. `--num-initializers-threshold` allows storing initializers to the\r\nirpa file in batches with a specified number of entries. This can reduce\r\nthe memory overhead of first gathering all of the initializers, then\r\nsaving them to the irpa at once.\r\n3. `--externalize-inputs-threshold` allows converting inputs to\r\nexternalized weights. This is useful for the following workflow:\r\nexporting a HF pytorch model with safetensors, saving a `.irpa` from the\r\nsafetensor weights directly, and exporting to onnx with\r\n`export_params\u003dFalse` and `do_constant_folding\u003dFalse` (which converts\r\nweights to inputs and avoids folding weights with things like\r\ntransposes). When importing to mlir, you can set\r\n`externalize-inputs-threshold\u003d\u003cnum_original_inputs\u003e` and it will convert\r\nthe inputs from and beyond that threshold to `util.global` ops.\r\n4. `--save-params`/`--no-save-params` factors saving parameters out of\r\n`import_initializer`, and one can avoid saving parameters with\r\n`--no-save-params`. Useful for debugging compilation failures.\r\n\r\n## TODO:\r\n\r\nFigure out what to do about loading the onnx model and updating opset\r\nversion. It\u0027s possible to do opset version updating without weights in a\r\nsomewhat hacky way, since models \u003e 2GB fail on opset version updating.\r\n\r\nAdd documentation\r\n\r\n---------\r\n\r\nSigned-off-by: zjgarvey \u003czjgarvey@gmail.com\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "fc108d8a65b204727d9db7610591587640b1aef6",
      "old_mode": 33188,
      "old_path": "compiler/bindings/python/iree/compiler/tools/import_onnx/__main__.py",
      "new_id": "81ec745603180419903bc7f1ccad46429817c42e",
      "new_mode": 33188,
      "new_path": "compiler/bindings/python/iree/compiler/tools/import_onnx/__main__.py"
    },
    {
      "type": "modify",
      "old_id": "d99b26974354b51973b6a12f4215714b6bf3dc65",
      "old_mode": 33188,
      "old_path": "compiler/bindings/python/iree/compiler/tools/import_onnx/importer_externalization_overrides.py",
      "new_id": "8146333816b2cffdf6a67291b5a91b0cd714676d",
      "new_mode": 33188,
      "new_path": "compiler/bindings/python/iree/compiler/tools/import_onnx/importer_externalization_overrides.py"
    },
    {
      "type": "modify",
      "old_id": "6089b65ef057d90f55d722ff14984f780d2f49d2",
      "old_mode": 33188,
      "old_path": "compiler/bindings/python/test/tools/import_onnx_test.py",
      "new_id": "0692e4cf7d7da0d76bec61eff17f96994902c5c2",
      "new_mode": 33188,
      "new_path": "compiler/bindings/python/test/tools/import_onnx_test.py"
    }
  ]
}
