use_existing_torch.py 596 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
for file in (*glob.glob("requirements/*.txt"), "pyproject.toml"):
7
8
9
10
11
    print(f">>> cleaning {file}")
    with open(file) as f:
        lines = f.readlines()
    if "torch" in "".join(lines).lower():
        print("removed:")
12
        with open(file, "w") as f:
13
            for line in lines:
14
                if "torch" not in line.lower():
15
16
17
                    f.write(line)
                else:
                    print(line.strip())
18
    print(f"<<< done cleaning {file}\n")