File tree Expand file tree Collapse file tree 7 files changed +54
-16
lines changed
Expand file tree Collapse file tree 7 files changed +54
-16
lines changed Original file line number Diff line number Diff line change 1616 uses : OpenBMB/BMTrain/.github/workflows/build_whl.yml@main
1717 secrets : inherit
1818
19- publish :
19+ fake- publish :
2020 needs : build-archive-wheel
2121 runs-on : ubuntu-latest
2222 steps :
2929 python-version : 3.9
3030
3131 - name : Download distribution files
32- uses : actions/download-artifact@v2
32+ uses : actions/download-artifact@v4
3333 with :
3434 name : dist
3535 path : dist
Original file line number Diff line number Diff line change @@ -44,12 +44,46 @@ jobs:
4444 version=${{ matrix.python-version }}
4545 docker run -e BUILD_DOCKER_ENV=1 -e CUDACXX=/usr/local/cuda-11.3/bin/nvcc -e PATH="/opt/rh/devtoolset-9/root/usr/bin:$PATH" -e LD_LIBRARY_PATH="/opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib:/usr/local/nvidia/lib:/usr/local/nvidia/lib64:$LD_LIBRARY_PATH" -v ${{ github.workspace }}:/workspace/BMTrain -i pytorch/manylinux-cuda113:latest /bin/bash -c "cd /workspace/BMTrain;/opt/python/cp${version}*/bin/pip install build; /opt/python/cp${version}*/bin/python -m build .;for file in dist/*-linux_x86_64.whl; do mv \"\$file\" \"\${file//-linux_x86_64/-manylinux2014_x86_64}\"; done"
4646
47+ - name : Upload wheels as artifacts
48+ uses : actions/upload-artifact@v4
49+ with :
50+ name : wheels_py${{ matrix.python-version }}
51+ path : dist/*.whl
52+
53+ - name : Upload source distribution (only once)
54+ if : matrix.python-version == '37' # Only upload source distribution once
55+ uses : actions/upload-artifact@v4
56+ with :
57+ name : source_dist
58+ path : dist/*.tar.gz
59+
60+ archive :
61+ runs-on : ubuntu-latest
62+ needs : build
63+ steps :
64+ - name : Download all wheels
65+ uses : actions/download-artifact@v4
66+ with :
67+ path : wheels
68+ pattern : wheels_py*
69+
70+ - name : Download source distribution
71+ uses : actions/download-artifact@v4
72+ with :
73+ path : source_dist
74+ name : source_dist
75+
76+ - name : Combine all wheels into a single directory
77+ run : |
78+ mkdir -p dist
79+ find wheels -name '*.whl' -exec mv {} dist/ \;
80+ find source_dist -name '*.tar.gz' -exec mv {} dist/ \;
81+
4782 - name : Archive distribution files
48- uses : actions/upload-artifact@v2
83+ uses : actions/upload-artifact@v4
4984 with :
5085 name : dist
5186 path : |
5287 dist/*.tar.gz
5388 dist/*.whl
54-
55-
89+ overwrite : true
Original file line number Diff line number Diff line change 2727 run : python -m pip install twine
2828
2929 - name : Download distribution files
30- uses : actions/download-artifact@v2
30+ uses : actions/download-artifact@v4
3131 with :
3232 name : dist
3333 path : dist
Original file line number Diff line number Diff line change @@ -27,21 +27,18 @@ jobs:
2727 python-version : 3.9
2828
2929 - name : Download distribution files
30- uses : actions/download-artifact@v2
30+ uses : actions/download-artifact@v4
3131 with :
3232 name : dist
3333 path : dist
3434
35- - name : Upload Distribution Files
35+ - name : Upload Distribution Files to Existing Release
3636 uses : softprops/action-gh-release@v1
3737 with :
38- body_path : " Release.txt"
3938 files : |
4039 dist/*.tar.gz
4140 dist/*.whl
42- prerelease : false
43- name : " BMTrain v0.2.3"
41+ tag_name : ${{ github.ref_name }} # 使用当前触发工作流的 tag
4442 token : ${{ secrets.RELEASE_TOKEN }}
45- tag_name : ${{ steps.create_release.outputs.tag }}
4643 env :
4744 GITHUB_REPOSITORY : OpenBMB/BMTrain
Original file line number Diff line number Diff line change @@ -308,7 +308,10 @@ def post_hook(self, out):
308308 post_out = tuple (post_out )
309309 return post_out
310310
311- def forward (self , * args ):
311+ def forward (self , * args , ** kwargs ):
312+ signature = inspect .signature (self ._module .forward )
313+ bound_args = signature .bind (* args , ** kwargs )
314+ args = bound_args .args
312315 arg_list = self .pre_hook (* args )
313316 if self .all_input_no_grad and not self .all_param_no_grad :
314317 placeholder = torch .tensor ([], requires_grad = torch .is_grad_enabled ())
Original file line number Diff line number Diff line change @@ -15,11 +15,15 @@ def make_distributed(model: torch.nn.Module):
1515 for kw in list (model ._buffers .keys ()):
1616 if model ._buffers [kw ] is not None :
1717 model ._buffers [kw ] = model ._buffers [kw ].cuda ()
18-
18+ is_module_list = isinstance (model , torch .nn .ModuleList )
19+ pre_module = None
1920 for kw in list (model ._modules .keys ()):
20- if isinstance ( model , torch . nn . ModuleList ) :
21+ if is_module_list :
2122 if not isinstance (model ._modules [kw ], Block ):
2223 model ._modules [kw ] = Block (model_wrapper_dispatch (model ._modules [kw ]))
24+ if pre_module is not None :
25+ model ._modules [kw ].set_pre_module (pre_module )
26+ pre_module = model ._modules [kw ]
2327 else :
2428 model ._modules [kw ] = model_wrapper_dispatch (model ._modules [kw ])
2529
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ def build_extension(self, ext):
9393]
9494setup (
9595 name = 'bmtrain' ,
96- version = '1.0.0 ' ,
96+ version = '1.0.1 ' ,
9797 author = "Guoyang Zeng" ,
98989999 description = "A toolkit for training big models" ,
You can’t perform that action at this time.
0 commit comments