Skip to content

Commit

Permalink
Wean ao off of PYBIND [part 1]
Browse files Browse the repository at this point in the history
[ghstack-poisoned]
  • Loading branch information
janeyx99 committed Nov 12, 2024
1 parent addcb24 commit d831de1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ def get_extensions():
if use_cuda:
sources += cuda_sources

if len(sources) == 0:
return None

ext_modules = [
extension(
"torchao._C",
Expand Down
6 changes: 4 additions & 2 deletions torchao/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
)
if not _IS_FBCODE:
try:
from . import _C
from pathlib import Path
so_files = list(Path(__file__).parent.glob("_C*.so"))
assert len(so_files) == 1, f"Expected one _C*.so file, found {len(so_files)}"
torch.ops.load_library(so_files[0])
from . import ops
except:
_C = None
logging.info("Skipping import of cpp extensions")

from torchao.quantization import (
Expand Down
3 changes: 0 additions & 3 deletions torchao/csrc/init.cpp

This file was deleted.

0 comments on commit d831de1

Please sign in to comment.