Skip to content

Commit

Permalink
support pip install on npu environment
Browse files Browse the repository at this point in the history
  • Loading branch information
sallyjunjun committed Aug 19, 2024
1 parent 81fb735 commit ff2a204
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,36 @@ def get_version():
content = f.read()
return content

def has_nvcc():
try:
subprocess.run(['nvcc', '--version'], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return True
except (subprocess.CalledProcessError, FileNotFoundError):
return False

def fetch_requirements(path):
with open(path, 'r') as fd:
return [r.strip() for r in fd.readlines() if 'torch-scatter' not in r and not r.startswith('-f ')]

if has_nvcc():
install_requires = [
fetch_requirements('requirements/runtime.txt'),
'rotary_emb',
'xentropy',
]
else:
install_requires = [
fetch_requirements('requirements/runtime.txt'),
]

setup(
name='InternEvo',
version=get_version(),
description='an open-sourced lightweight training framework aims to support model pre-training without the need for extensive dependencies',
long_description=readme(),
long_description_content_type='text/markdown',
packages=find_packages(),
install_requires=[
fetch_requirements('requirements/runtime.txt'),
'rotary_emb',
'xentropy',
],

install_requires=install_requires,
classifiers=[
'Programming Language :: Python :: 3.10',
'Intended Audience :: Developers',
Expand Down

0 comments on commit ff2a204

Please sign in to comment.