From 21c9673435acc66f683c2213c576da81b47e508f Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 6 Aug 2024 16:18:14 -0700 Subject: [PATCH] Load quantized_ops_aot_lib during portable load --- extension/pybindings/portable_lib.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/extension/pybindings/portable_lib.py b/extension/pybindings/portable_lib.py index b9ed089f91..7d04989711 100644 --- a/extension/pybindings/portable_lib.py +++ b/extension/pybindings/portable_lib.py @@ -29,6 +29,15 @@ ExecuTorchModule, # noqa: F401 ) + try: + from pathlib import Path + libs = list(Path(__file__).parent.parent.parent.resolve().glob("**/libquantized_ops_aot_lib.*")) + del Path + assert len(libs) == 1, f"Expected 1 library but got {len(libs)}" + _torch.ops.load_library(libs[0]) + except: + pass + # Clean up so that `dir(portable_lib)` is the same as `dir(_portable_lib)` # (apart from some __dunder__ names). del _torch