-
Notifications
You must be signed in to change notification settings - Fork 1
NPU add titan test #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b2718a9
NPU add titan test
lowdy1 1289a93
NPU add torchtitan test
lowdy1 52e285a
NPU add titan test
lowdy1 2fcbff8
add torchtitan
lowdy1 895ffd2
add titan
lowdy1 5a6f32e
add torchtitan
lowdy1 37d8939
del benchmark temporarily
lowdy1 e1c26ff
run as fast as possible
lowdy1 dd69230
Merge branch 'main' into ascend-npu/torchtitan
lowdy1 17771c9
run as fast as possible
lowdy1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,140 @@ | ||
| name: "_ascend_npu_torchtitan" | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| runner: | ||
| required: true | ||
| type: string | ||
| description: "The runner selected to run on" | ||
| image: | ||
| required: true | ||
| type: string | ||
| description: "The docker image which will be loaded" | ||
| device: | ||
| required: true | ||
| type: string | ||
| description: "The device selected to run on" | ||
| torch-artifact: | ||
| required: false | ||
| type: string | ||
| description: "The distribution artifact name of torch" | ||
| torch-npu-artifact: | ||
| required: true | ||
| type: string | ||
| description: "The distribution artifact name of torch_npu" | ||
| secrets: | ||
| pr-token: | ||
| description: "A token used to create a pull request" | ||
| required: true | ||
|
|
||
| # Bash shells do not use ~/.profile or ~/.bashrc so these shells need to be explicitly | ||
| # declared as "shell: bash -el {0}" on steps that need to be properly activated. | ||
| # It's used to activate ascend-toolkit environment variables. | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash -el {0} | ||
|
|
||
| jobs: | ||
| setup_environment: | ||
| name: Run Torchtitan Environment | ||
| runs-on: ${{ inputs.runner }} | ||
| container: | ||
| image: ${{ inputs.image }} | ||
| env: | ||
| HF_ENDPOINT: https://hf-mirror.com | ||
| outputs: | ||
| torch_version: ${{ steps.get_torch_version.outputs.torch-version }} | ||
| npu_info: ${{ steps.check_npu.outputs.npu_info }} | ||
| steps: | ||
| - name: Show NPU info | ||
| run: | | ||
| npu-smi info | ||
|
|
||
| - name: Config mirrors | ||
| run: | | ||
| sed -i 's|ports.ubuntu.com|mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list | ||
| pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple | ||
|
|
||
| - name: Install system dependencies | ||
| run: | | ||
| apt-get update | ||
| apt-get install -y \ | ||
| git gcc g++ make cmake ninja-build curl \ | ||
| libgl1 libglib2.0-0 libsndfile1 | ||
|
|
||
| - name: Config git | ||
| run: | | ||
| git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
| git config --global url."https://gh-proxy.test.osinfra.cn/https://github.com/".insteadOf https://github.com/ | ||
|
|
||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Checkout benchmark | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: pytorch/torchtitan | ||
| path: torchtitan | ||
|
|
||
| - name: Download torch artifact | ||
| if: ${{ inputs.torch-artifact }} | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: ${{ inputs.torch-artifact }} | ||
|
|
||
| - name: Install torch | ||
| if: ${{ inputs.torch-artifact }} | ||
| run: | | ||
| pip install ${{ inputs.torch-artifact }} | ||
|
|
||
| - name: Install torch_npu dependencies | ||
| if: ${{ !inputs.torch-artifact }} | ||
| run: | | ||
| pip install -r https://raw.githubusercontent.com/Ascend/pytorch/refs/heads/master/requirements.txt | ||
|
|
||
| - name: List torch version | ||
| id: list-torch-version | ||
| shell: bash | ||
| run: | | ||
| torch_version=$(python -c "import torch; print(torch.__version__)") | ||
| echo "torch-version=${torch_version}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Download torch_npu artifact | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: ${{ inputs.torch-npu-artifact }} | ||
| path: ascend_npu | ||
|
|
||
| - name: Install torch_npu | ||
| working-directory: ascend_npu | ||
| run: | | ||
| pip install ${{ inputs.torch-npu-artifact }} | ||
|
|
||
| - name: Install nightly torchvision and torchaudio | ||
| run: | | ||
| pip install --pre torchvision torchaudio --no-deps --index-url https://download.pytorch.org/whl/nightly/cpu | ||
|
||
|
|
||
| - name: Install project dependencies | ||
| run: | | ||
| pip install -r requirements.txt | ||
| pip install pytest pytest-cov | ||
|
|
||
| - name: Show environment info | ||
| run: | | ||
| npu_is_available=$(python -c "import torch; print(torch.npu.is_available())") | ||
| npu_count=$(python -c "import torch; print(torch.npu.device_count())") | ||
| echo "NPU is available: ${npu_is_available}" | ||
| echo "NPU count: ${npu_count}" | ||
| pip list | grep -E 'torch|numpy' | ||
|
|
||
| - name: Run torchtitan integration_test | ||
| run: | | ||
| mkdir artifacts-to-be-uploaded | ||
| npu_count=$(python -c "import torch; print(torch.npu.device_count())") | ||
| python ./tests/integration_tests.py artifacts-to-be-uploaded --ngpu ${npu_count} | ||
|
|
||
| - name: Run torchtitan unittest | ||
| run: | | ||
| pytest ./tests/unit_tests --cov=. --cov-report=xml --durations=20 -vv | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ on: | |
| - ".github/workflows/_ascend_npu_build_torch_npu.yml" | ||
| - ".github/workflows/_ascend_npu_ut.yml" | ||
| - ".github/workflows/_ascend_npu_benchmark.yml" | ||
| - ".github/workflows/_ascend_npu_torchtitan.yml" | ||
| - ".ci/**" | ||
| - "ascend_npu/**" | ||
| - "src/**" | ||
|
|
@@ -23,6 +24,7 @@ on: | |
| - ".github/workflows/_ascend_npu_build_torch_npu.yml" | ||
| - ".github/workflows/_ascend_npu_ut.yml" | ||
| - ".github/workflows/_ascend_npu_benchmark.yml" | ||
| - ".github/workflows/_ascend_npu_torchtitan.yml" | ||
| - ".ci/**" | ||
| - "ascend_npu/**" | ||
| - "src/**" | ||
|
|
@@ -157,7 +159,6 @@ jobs: | |
| - prepare | ||
| - build-torch | ||
| - build | ||
| - test | ||
| if: | | ||
| !cancelled() && github.event_name != 'repository_dispatch' && | ||
| (success() || (needs.build-torch.result == 'skipped' && needs.build.result == 'success')) | ||
|
|
@@ -170,3 +171,22 @@ jobs: | |
| torch-npu-artifact: ${{ needs.build.outputs.torch-npu-artifact }} | ||
| secrets: | ||
| pr-token: ${{ secrets.COSDT_BOT_TOKEN }} | ||
|
|
||
| torchtitan: | ||
| name: Run torchtitan | ||
| needs: | ||
| - prepare | ||
| - build-torch | ||
| - build | ||
| if: | | ||
| !cancelled() && github.event_name != 'repository_dispatch' && | ||
| (success() || (needs.build-torch.result == 'skipped' && needs.build.result == 'success')) | ||
| uses: ./.github/workflows/_ascend_npu_torchtitan.yml | ||
| with: | ||
| runner: "linux-arm64-npu-2" | ||
| image: ${{ needs.prepare.outputs.image }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use |
||
| device: ${{ needs.prepare.outputs.device }} | ||
| torch-artifact: ${{ needs.build-torch.outputs.torch-artifact }} | ||
| torch-npu-artifact: ${{ needs.build.outputs.torch-npu-artifact }} | ||
| secrets: | ||
| pr-token: ${{ secrets.COSDT_BOT_TOKEN }} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.