diff --git a/torchao/__init__.py b/torchao/__init__.py index b0baf6ff4a..c73ab3e7d5 100644 --- a/torchao/__init__.py +++ b/torchao/__init__.py @@ -6,6 +6,7 @@ import warnings import torch +from torchao.utils import is_fbcode warnings.filterwarnings( "ignore", message="Failed to initialize NumPy: No module named 'numpy'" @@ -48,7 +49,7 @@ def _parse_version(version_string): force_skip_loading_so_files = ( os.getenv("TORCHAO_FORCE_SKIP_LOADING_SO_FILES", "0") == "1" ) -if force_skip_loading_so_files: +if force_skip_loading_so_files or is_fbcode(): # user override # users can set env var TORCHAO_FORCE_SKIP_LOADING_SO_FILES=1 to skip loading .so files # this way, if they are using an incompatbile torch version, they can still use the API by setting the env var