mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Fixes #ISSUE_NUMBER unstable https://github.com/pytorch/pytorch/issues/164362 Pull Request resolved: https://github.com/pytorch/pytorch/pull/164361 Approved by: https://github.com/huydhn Co-authored-by: Huy Do <huydhn@gmail.com>
23 lines
592 B
Python
23 lines
592 B
Python
import glob
|
|
import os
|
|
|
|
|
|
requires_files = glob.glob("requirements/*.txt")
|
|
requires_files += ["pyproject.toml"]
|
|
|
|
for file in requires_files:
|
|
if not os.path.exists(file):
|
|
print(f"!!! skipping missing {file}")
|
|
continue
|
|
print(f">>> cleaning {file}")
|
|
with open(file) 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)
|
|
print(f"<<< done cleaning {file}")
|
|
print()
|