mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2026-08-17 13:35:44 +08:00
[docker] upgrade NPU images to CANN 9.1 and PyTorch 2.10 (#10729)
This commit is contained in:
45
.github/workflows/docker_npu.yml
vendored
45
.github/workflows/docker_npu.yml
vendored
@@ -17,16 +17,16 @@ jobs:
|
||||
include:
|
||||
- device: "npu-a2"
|
||||
os: "ubuntu"
|
||||
base_image: "quay.io/ascend/cann:9.0.0-910b-ubuntu22.04-py3.11"
|
||||
base_image: "quay.io/ascend/cann:9.1.0-910b-ubuntu22.04-py3.12"
|
||||
- device: "npu-a3"
|
||||
os: "ubuntu"
|
||||
base_image: "quay.io/ascend/cann:9.0.0-a3-ubuntu22.04-py3.11"
|
||||
base_image: "quay.io/ascend/cann:9.1.0-a3-ubuntu22.04-py3.12"
|
||||
- device: "npu-a2"
|
||||
os: "openeuler"
|
||||
base_image: "quay.io/ascend/cann:9.0.0-910b-openeuler24.03-py3.11"
|
||||
base_image: "quay.io/ascend/cann:9.1.0-910b-openeuler24.03-py3.12"
|
||||
- device: "npu-a3"
|
||||
os: "openeuler"
|
||||
base_image: "quay.io/ascend/cann:9.0.0-a3-openeuler24.03-py3.11"
|
||||
base_image: "quay.io/ascend/cann:9.1.0-a3-openeuler24.03-py3.12"
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Get llamafactory version
|
||||
- name: Get LlamaFactory version
|
||||
id: version
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "release" ]; then
|
||||
@@ -61,29 +61,46 @@ jobs:
|
||||
id: npu_tag
|
||||
env:
|
||||
BASE_IMAGE: ${{ matrix.base_image }}
|
||||
DEVICE: ${{ matrix.device }}
|
||||
MATRIX_DEVICE: ${{ matrix.device }}
|
||||
MATRIX_OS: ${{ matrix.os }}
|
||||
LLAMAFACTORY_VERSION: ${{ steps.version.outputs.tag }}
|
||||
run: |
|
||||
base_image_tag="${BASE_IMAGE##*:}"
|
||||
cann_version="${base_image_tag%%-*}"
|
||||
torch_npu_version="$(sed -nE 's/^torch[-_]npu==([0-9]+(\.[0-9]+)*).*/\1/p' requirements/npu.txt)"
|
||||
accelerator="${DEVICE#npu-}"
|
||||
accelerator="${accelerator^^}"
|
||||
operating_system="$(grep -oE '(ubuntu|openeuler)' <<< "${base_image_tag}" | head -n 1)"
|
||||
torch_npu_version="$(sed -nE 's/^torch[-_]npu==([0-9]+(\.[0-9]+)*(\.post[0-9]+)?).*/\1/p' requirements/npu.txt)"
|
||||
soc="$(grep -oE '(910b|a3)' <<< "${base_image_tag}" | head -n 1)"
|
||||
operating_system="$(grep -oE '(ubuntu|openeuler)[0-9]+(\.[0-9]+)*' <<< "${base_image_tag}" | head -n 1)"
|
||||
python_version="$(grep -oE 'py[0-9]+\.[0-9]+' <<< "${base_image_tag}" | head -n 1)"
|
||||
|
||||
if [[ -z "${cann_version}" || -z "${torch_npu_version}" || -z "${operating_system}" || -z "${python_version}" ]]; then
|
||||
if [[ -z "${cann_version}" || -z "${torch_npu_version}" || -z "${soc}" || -z "${operating_system}" || -z "${python_version}" ]]; then
|
||||
echo "Failed to derive the NPU image tag from ${BASE_IMAGE} and requirements/npu.txt" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${operating_system}" != "${MATRIX_OS}" ]]; then
|
||||
echo "Operating system ${operating_system} derived from ${BASE_IMAGE} does not match matrix OS ${MATRIX_OS}" >&2
|
||||
if [[ "${operating_system}" != "${MATRIX_OS}"* ]]; then
|
||||
echo "Operating system ${operating_system} derived from ${BASE_IMAGE} does not match matrix OS family ${MATRIX_OS}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "tag=${LLAMAFACTORY_VERSION}-cann${cann_version}-torch_npu${torch_npu_version}-${accelerator}-${operating_system}-${python_version}" >> "$GITHUB_OUTPUT"
|
||||
case "${MATRIX_DEVICE}" in
|
||||
npu-a2) expected_soc="910b" ;;
|
||||
npu-a3) expected_soc="a3" ;;
|
||||
*)
|
||||
echo "Unsupported NPU device ${MATRIX_DEVICE}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ "${soc}" != "${expected_soc}" ]]; then
|
||||
echo "SoC ${soc} derived from ${BASE_IMAGE} does not match matrix device ${MATRIX_DEVICE}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${LLAMAFACTORY_VERSION}" == "latest" ]]; then
|
||||
echo "tag=latest-${soc}-${MATRIX_OS}" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "tag=${LLAMAFACTORY_VERSION}-cann${cann_version}-torch_npu${torch_npu_version}-${soc}-${operating_system}-${python_version}" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
6
.github/workflows/tests_npu.yml
vendored
6
.github/workflows/tests_npu.yml
vendored
@@ -25,11 +25,11 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python:
|
||||
- "3.11"
|
||||
- "3.12"
|
||||
os:
|
||||
- "linux-aarch64-a2-4"
|
||||
pytorch_npu:
|
||||
- "2.7.1"
|
||||
- "2.10.0"
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||
|
||||
container:
|
||||
image: ascendai/cann:9.0.0-910b-ubuntu22.04-py3.11
|
||||
image: ascendai/cann:9.1.0-910b-ubuntu22.04-py3.12
|
||||
env:
|
||||
HF_ENDPOINT: https://hf-mirror.com
|
||||
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user