Skip to content

Commit

Permalink
hooks: fix for torch and triton backends (#2751)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelotduarte authored Dec 29, 2024
1 parent 181ce49 commit 962861d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cx_Freeze/hooks/torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,9 @@ def load_torch__dynamo_skipfiles(finder: ModuleFinder, module: Module) -> None:
dont_inherit=True,
optimize=finder.optimize,
)


def load_torch__numpy(finder: ModuleFinder, module: Module) -> None:
"""Patch to work in Windows."""
finder.exclude_module("torch._numpy.testing")
finder.include_package(module.name)
7 changes: 7 additions & 0 deletions cx_Freeze/hooks/triton.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,10 @@ def load_triton(finder: ModuleFinder, module: Module) -> None:
source_lib = module.file.parent / "_C"
if source_lib.exists():
finder.include_files(source_lib, f"lib/{module.name}/_C")

# exclude backends module, but include its source modules
finder.exclude_module("triton.backends")
backends_path = module.file.parent / "backends"
for source in backends_path.rglob("*.py"): # type: Path
target = f"lib/{module.name}" / source.relative_to(backends_path)
finder.include_files(source, target)

0 comments on commit 962861d

Please sign in to comment.