use_existing_torch.py 654 Bytes
Newer Older
1
# SPDX-License-Identifier: Apache-2.0
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3

4
5
import glob

6
requires_files = glob.glob("requirements/*.txt")
7
8
9
10
11
12
13
requires_files += ["pyproject.toml"]
for file in requires_files:
    print(f">>> cleaning {file}")
    with open(file) as f:
        lines = f.readlines()
    if "torch" in "".join(lines).lower():
        print("removed:")
14
        with open(file, "w") as f:
15
            for line in lines:
16
                if "torch" not in line.lower():
17
18
19
20
                    f.write(line)
                else:
                    print(line.strip())
    print(f"<<< done cleaning {file}")
21
    print()