|
9 | 9 | import logging |
10 | 10 | import math |
11 | 11 | import os |
| 12 | +import platform |
12 | 13 | import shutil |
13 | 14 | import subprocess |
14 | 15 | import sys |
@@ -928,7 +929,30 @@ def load(self) -> bool: |
928 | 929 | elapsed = time.perf_counter() - started |
929 | 930 | self._load_attempted = True |
930 | 931 | self._load_result = False |
931 | | - self._last_error = f"{self.display_name}: failed to build torch.ops JIT extension: {exc}" |
| 932 | + diagnostic_lines = [ |
| 933 | + f"{self.display_name}: failed to build torch.ops JIT extension: {exc}", |
| 934 | + f"build_root={build_root}", |
| 935 | + f"base_build_root={base_build_root}", |
| 936 | + f"python={platform.python_version()}", |
| 937 | + f"pid={os.getpid()}", |
| 938 | + f"TORCH_EXTENSIONS_DIR={os.getenv('TORCH_EXTENSIONS_DIR', '')}", |
| 939 | + f"GPTQMODEL_TORCH_EXTENSIONS_DIR={os.getenv('GPTQMODEL_TORCH_EXTENSIONS_DIR', '')}", |
| 940 | + ] |
| 941 | + candidate_paths = self._candidate_binary_paths(build_root) |
| 942 | + if candidate_paths: |
| 943 | + diagnostic_lines.append( |
| 944 | + "candidate_binaries=" |
| 945 | + + ", ".join(f"{path}:{'exists' if path.exists() else 'missing'}" for path in candidate_paths) |
| 946 | + ) |
| 947 | + try: |
| 948 | + entries = sorted(build_root.iterdir()) |
| 949 | + preview = ", ".join(entry.name for entry in entries[:24]) |
| 950 | + if len(entries) > 24: |
| 951 | + preview += f", ... (+{len(entries) - 24} more)" |
| 952 | + diagnostic_lines.append(f"build_root_entries=[{preview}]") |
| 953 | + except OSError as snapshot_exc: |
| 954 | + diagnostic_lines.append(f"build_root_entries=<unavailable: {snapshot_exc}>") |
| 955 | + self._last_error = " | ".join(diagnostic_lines) |
932 | 956 | log.debug("%s", self._last_error, exc_info=True) |
933 | 957 | logger.info( |
934 | 958 | f"{self.display_name}: torch.ops JIT compilation failed " |
|
0 commit comments