Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions .github/workflows/ascend_npu_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Ascend NPU

on:
push:
branches:
- main
paths:
- "src/liger_kernel/ops/backends/_ascend/**"
- "test/**"
pull_request:
branches:
- main
workflow_dispatch:
inputs:
runner:
required: true
type: choice
options:
- linux-aarch64-a2-1
- linux-aarch64-a2-2
- linux-aarch64-a2-4
- linux-aarch64-a2-8
default: "linux-aarch64-a2-1"
description: "The runner selected to run on"
schedule:
- cron: "0 12 * * *"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
checkstyle:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'

- name: Checkout Liger-Kernel
uses: actions/checkout@v6

- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
activate-environment: true

- name: Install dependencies
run: |
uv pip install -r dev/fmt-requirements.txt
uv pip list

- name: Run checkstyle
run: make checkstyle

tests:
name: Tests (${{ matrix.name }})
runs-on: ${{ github.event.inputs.runner || 'linux-aarch64-a2-1' }}
needs: [checkstyle]
if: success()
strategy:
fail-fast: false
matrix:
include:
- name: transformers
command: python -m pytest test/transformers --cov=src/liger_kernel --cov-report=term-missing --disable-warnings --ignore=test/transformers/test_fused_neighborhood_attention.py
# - name: full
# command: make test
container:
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.3.rc1-910b-ubuntu22.04-py3.11
options: >-
--privileged
-v /dev/davinci_manager:/dev/davinci_manager
-v /dev/devmm_svm:/dev/devmm_svm
-v /dev/hisi_hdc:/dev/hisi_hdc
--ipc=host
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Set up Python
run: |
# Python should be pre-installed in the container image
python --version

- name: Verify NPU availability
run: |
npu-smi info
echo "NPU devices available"
cat $ASCEND_TOOLKIT_HOME/toolkit/version.info

- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
activate-environment: true

- name: Setup Dependencies
run: |
uv pip install -e .[dev]

- name: Install torch_npu and triton-ascend
run: |
uv pip install attrs==24.2.0 numpy==1.26.4 scipy==1.13.1 decorator==5.1.1 psutil==6.0.0 pytest==9.0.2 pytest-xdist==3.6.1 pyyaml pybind11 transformers==4.57.6
uv pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 --index-url https://download.pytorch.org/whl/cpu
uv pip install torch_npu==2.6.0
uv pip install triton-ascend==3.2.0rc4
python3 -c "import torch; import torch_npu; print(torch_npu.npu.is_available())"
python -c "import torch_npu; print('torch_npu version:', torch_npu.__version__)"

- name: List Python Environments
run: uv pip list

- name: Run Unit Tests
run: |
${{ matrix.command }}
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,11 @@ loss.backward()
<img src="https://github.com/linkedin/Liger-Kernel/actions/workflows/intel-ci.yml/badge.svg?branch=main&event=push" alt="Build">
</a>
</div>
<div style="display: block;">
<a href="https://github.com/linkedin/Liger-Kernel/actions/workflows/ascend_npu_ci.yml">
<img src="https://github.com/linkedin/Liger-Kernel/actions/workflows/ascend_npu_ci.yml/badge.svg?branch=main" alt="Build">
</a>
</div>
</td>
</tr>
</table>
Expand Down
Loading