[build] enable existing pytorch (for GH200, aarch64, nightly) (#8713)

This commit is contained in:
youkaichao
2024-09-22 12:47:54 -07:00
committed by GitHub
parent c6bd70d772
commit d4a2ac8302
3 changed files with 42 additions and 1 deletions

18
use_existing_torch.py Normal file
View File

@ -0,0 +1,18 @@
import glob
requires_files = glob.glob('requirements*.txt')
requires_files += ["pyproject.toml"]
for file in requires_files:
print(f">>> cleaning {file}")
with open(file, 'r') as f:
lines = f.readlines()
if "torch" in "".join(lines).lower():
print("removed:")
with open(file, 'w') as f:
for line in lines:
if 'torch' not in line.lower():
f.write(line)
else:
print(line.strip())
print(f"<<< done cleaning {file}")
print()