From 6cdbfa980ef4638f7b2b70835e7f86a49ca2e388 Mon Sep 17 00:00:00 2001 From: hiyouga Date: Sat, 27 Dec 2025 08:46:17 +0800 Subject: [PATCH] fix --- .github/workflows/publish.yml | 7 ++++--- Makefile | 13 +++++++------ docker/docker-cuda/Dockerfile | 4 ++-- docker/docker-npu/Dockerfile | 10 ++++------ docker/docker-rocm/Dockerfile | 11 ++++------- 5 files changed, 21 insertions(+), 24 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c3f729a08..7c8a1e433 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,10 +23,11 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 + - name: Install uv + uses: astral-sh/setup-uv@v7 with: - python-version: "3.9" + python-version: "3.11" + github-token: ${{ github.token }} - name: Build package run: | diff --git a/Makefile b/Makefile index f30b15c1a..509718637 100644 --- a/Makefile +++ b/Makefile @@ -4,24 +4,25 @@ check_dirs := scripts src tests tests_v1 RUN := $(shell command -v uv >/dev/null 2>&1 && echo "uv run" || echo "") BUILD := $(shell command -v uv >/dev/null 2>&1 && echo "uv build" || echo "python -m build") +TOOL := $(shell command -v uv >/dev/null 2>&1 && echo "uvx" || echo "") build: $(BUILD) commit: - $(RUN) pre-commit install - $(RUN) pre-commit run --all-files + $(TOOL) pre-commit install + $(TOOL) pre-commit run --all-files license: $(RUN) python3 tests/check_license.py $(check_dirs) quality: - $(RUN) ruff check $(check_dirs) - $(RUN) ruff format --check $(check_dirs) + $(TOOL) ruff check $(check_dirs) + $(TOOL) ruff format --check $(check_dirs) style: - $(RUN) ruff check $(check_dirs) --fix - $(RUN) ruff format $(check_dirs) + $(TOOL) ruff check $(check_dirs) --fix + $(TOOL) ruff format $(check_dirs) test: WANDB_DISABLED=true $(RUN) pytest -vv --import-mode=importlib tests/ tests_v1/ diff --git a/docker/docker-cuda/Dockerfile b/docker/docker-cuda/Dockerfile index 2315a85b7..b70ad5b50 100644 --- a/docker/docker-cuda/Dockerfile +++ b/docker/docker-cuda/Dockerfile @@ -26,13 +26,13 @@ WORKDIR /app # Change pip source RUN pip config set global.index-url "${PIP_INDEX}" && \ pip config set global.extra-index-url "${PIP_INDEX}" && \ - pip install --no-cache-dir --upgrade pip packaging wheel setuptools "hatchling>=1.18.0" editables + pip install --no-cache-dir --upgrade pip packaging wheel setuptools editables "hatchling>=1.18.0" # Copy the application into the image COPY . /app # Install LLaMA Factory -RUN pip install --no-cache-dir -e ".[metrics,deepspeed]" --no-build-isolation +RUN pip install --no-cache-dir --no-build-isolation -e ".[metrics,deepspeed]" # Rebuild flash attention RUN if [ "${INSTALL_FLASHATTN}" == "true" ]; then \ diff --git a/docker/docker-npu/Dockerfile b/docker/docker-npu/Dockerfile index f58c8d4d9..c2f495588 100644 --- a/docker/docker-npu/Dockerfile +++ b/docker/docker-npu/Dockerfile @@ -29,15 +29,13 @@ RUN pip config set global.index-url "${PIP_INDEX}" && \ pip config set global.extra-index-url "${PIP_INDEX}" && \ pip install --no-cache-dir --upgrade pip packaging wheel setuptools "hatchling>=1.18.0" editables -# Install torch-npu -RUN pip uninstall -y torch torchvision torchaudio && \ - pip install --no-cache-dir "torch==2.7.1" "torch-npu==2.7.1" "torchvision==0.22.1" --index-url "${PYTORCH_INDEX}" - # Copy the application into the image COPY . /app -# Install LLaMA Factory -RUN pip install --no-cache-dir -e ".[metrics]" --no-build-isolation +# Install torch-npu +RUN pip uninstall -y torch torchvision torchaudio && \ + pip install --no-cache-dir --no-build-isolation -e ".[metrics]" \ + "torch==2.7.1" "torch-npu==2.7.1" "torchvision==0.22.1" "torchaudio==2.7.1" --index-url "${PYTORCH_INDEX}" # Set up volumes # VOLUME [ "/root/.cache/huggingface", "/app/shared_data", "/app/output" ] diff --git a/docker/docker-rocm/Dockerfile b/docker/docker-rocm/Dockerfile index 93e44e535..f764ee5e8 100644 --- a/docker/docker-rocm/Dockerfile +++ b/docker/docker-rocm/Dockerfile @@ -27,17 +27,14 @@ WORKDIR /app # Change pip source RUN pip config set global.index-url "${PIP_INDEX}" && \ pip config set global.extra-index-url "${PIP_INDEX}" && \ - pip install --no-cache-dir --upgrade pip packaging wheel setuptools "hatchling>=1.18.0" editables - -# Reinstall pytorch rocm -RUN pip uninstall -y torch torchvision torchaudio && \ - pip install --no-cache-dir --pre torch torchvision torchaudio --index-url "${PYTORCH_INDEX}" + pip install --no-cache-dir --upgrade pip packaging wheel setuptools editables "hatchling>=1.18.0" # Copy the application into the image COPY . /app -# Install LLaMA Factory -RUN pip install --no-cache-dir -e ".[metrics,deepspeed]" --no-build-isolation +# Reinstall pytorch rocm and install LLaMA Factory +RUN pip uninstall -y torch torchvision torchaudio && \ + pip install --no-cache-dir -e --pre ".[metrics,deepspeed]" --index-url "${PYTORCH_INDEX}" # Rebuild flash attention RUN if [ "${INSTALL_FLASHATTN}" == "true" ]; then \