unsloth/use_existing_torch.py
billishyahao a9635c964e [Feature] enable unsloth on amd gpu (#2520)
* [Feature] enable unsloth on amd gpu

* fix the comment

---------

Co-authored-by: Daniel Han <danielhanchen@gmail.com>
2025-06-30 16:52:05 -07:00

22 lines
758 B
Python

# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project and Unsloth project
# Copying from https://github.com/vllm-project/vllm/blob/main/use_existing_torch.py
import glob
requires_files = glob.glob('requirements/*.txt')
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:")
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()