-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cba90e6
commit 82fd0d8
Showing
5 changed files
with
126 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Build and Upload Package to Pypi | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "develop" | ||
|
||
create: | ||
tags: | ||
- "*" | ||
|
||
env: | ||
WORKSPACE_PREFIX: $(echo $GITHUB_WORKSPACE |cut -d '/' -f 1-4) | ||
SLURM_PARTITION: llm_s | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
|
||
jobs: | ||
build_and_upload: | ||
runs-on: [t_cluster] | ||
steps: | ||
- name: mask env | ||
run: | | ||
echo "::add-mask::${{env.WORKSPACE_PREFIX}}" | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Extract version from tag | ||
id: extract_version | ||
run: echo "::set-output name=version::$(echo ${{ github.ref }} | sed -n 's/refs\/tags\/v\(.*\)/\1/p')" | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install setuptools wheel twine | ||
- name: Build and upload package | ||
run: | | ||
source /mnt/petrelfs/share_data/llm_env/env/llm-flash2.0 | ||
srun -p ${SLURM_PARTITION} --kill-on-bad-exit=1 --job-name=internlm-ut-${GITHUB_RUN_ID}-${GITHUB_JOB} -N 1 -n 1 --gres=gpu:8 python setup.py sdist bdist_wheel | ||
twine upload --verbose --repository pypi dist/* | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,5 @@ botocore | |
torch-scatter | ||
pyecharts | ||
py-libnuma | ||
tensorboard | ||
-f https://data.pyg.org/whl/torch-1.13.1+cu117.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import os | ||
import re | ||
import sys | ||
import subprocess | ||
from setuptools import setup, find_packages | ||
from setuptools.command.install import install | ||
|
||
pwd = os.path.dirname(__file__) | ||
|
||
def readme(): | ||
with open(os.path.join(pwd, 'README.md'), encoding='utf-8') as f: | ||
content = f.read() | ||
return content | ||
|
||
def get_version(): | ||
with open(os.path.join(pwd, 'version.txt'), 'r') as f: | ||
content = f.read() | ||
return content | ||
|
||
class CustomInstall(install): | ||
def run(self): | ||
install.run(self) | ||
|
||
def custom_install_step(path, command): | ||
original_dir = os.getcwd() | ||
os.chdir(path) | ||
subprocess.check_call(command, shell=True) | ||
os.chdir(original_dir) | ||
|
||
custom_install_step('./requirements', 'pip install -r torch.txt') | ||
custom_install_step('./requirements', 'pip install -r runtime.txt') | ||
custom_install_step('./third_party/flash-attention', 'python setup.py install') | ||
custom_install_step('./third_party/flash-attention/csrc/fused_dense_lib', 'pip install -v .') | ||
custom_install_step('./third_party/flash-attention/csrc/xentropy', 'pip install -v .') | ||
custom_install_step('./third_party/flash-attention/csrc/rotary', 'pip install -v .') | ||
custom_install_step('./third_party/flash-attention/csrc/layer_norm', 'pip install -v .') | ||
custom_install_step('./third_party/apex', 'pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./') | ||
|
||
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(), | ||
setup_requires=[ | ||
'flash-attention', | ||
'apex', | ||
], | ||
dependency_links=[ | ||
'git+https://github.com/Dao-AILab/flash-attention.git#egg=flash-attention', | ||
'git+https://github.com/NVIDIA/apex.git#egg=apex', | ||
], | ||
cmdclass={ | ||
'install': CustomInstall, | ||
}, | ||
classifiers=[ | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Programming Language :: Python :: 3.10', | ||
'Programming Language :: Python :: 3.11', | ||
'Intended Audience :: Developers', | ||
'Intended Audience :: Education', | ||
'Intended Audience :: Science/Research', | ||
], | ||
) |