Skip to content

Commit

Permalink
README update and clean build cache
Browse files Browse the repository at this point in the history
  • Loading branch information
MayDomine committed Aug 17, 2023
1 parent df50673 commit c54af2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ BMTrain 是一个高效的大模型训练工具包,可以用于训练数百亿

- 用 pip 安装(推荐): ``pip install bmtrain``

- 从源代码安装: 下载工具包,然后运行 ``python setup.py install``
- 从源代码安装: 下载工具包,然后运行 ``pip install .`` (setup.py的安装方式将会在未来被setuptools弃用)

安装 BMTrain 可能需要花费数分钟的时间,因为在安装时需要编译 c/cuda 源代码。
我们推荐直接在训练环境中编译 BMTrain,以避免不同环境带来的潜在问题。
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import shutil
from setuptools.command.build_ext import build_ext
from setuptools import setup, find_packages, Extension
import setuptools
Expand Down Expand Up @@ -79,9 +80,9 @@ def build_extension(self, ext):
build_args += [f"-j{self.parallel}"]

build_temp = os.path.join(self.build_temp, ext.name)
if not os.path.exists(build_temp):
os.makedirs(build_temp)

if os.path.exists(build_temp):
shutil.rmtree(build_temp)
os.makedirs(build_temp)
cmake_args += ["-DPython_ROOT_DIR=" + os.path.dirname(os.path.dirname(sys.executable))]
subprocess.check_call(["cmake", ext.sourcedir] + cmake_args, cwd=build_temp)
subprocess.check_call(["cmake", "--build", "."] + build_args, cwd=build_temp)
Expand Down

0 comments on commit c54af2a

Please sign in to comment.