diff --git a/.github/workflows/build-and-release.yaml b/.github/workflows/build-and-release.yaml deleted file mode 100644 index 76b5f7fcf..000000000 --- a/.github/workflows/build-and-release.yaml +++ /dev/null @@ -1,80 +0,0 @@ -name: Build Release - -on: workflow_dispatch - -permissions: - contents: write - -jobs: - build_wheels: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-20.04, windows-2019, macos-11] - - steps: - - uses: actions/checkout@v3 - with: - submodules: "recursive" - - # Used to host cibuildwheel - - uses: actions/setup-python@v3 - with: - python-version: "3.8" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -e .[all] - - - name: Build wheels - uses: pypa/cibuildwheel@v2.16.5 - env: - # disable repair - CIBW_REPAIR_WHEEL_COMMAND: "" - with: - package-dir: . - output-dir: wheelhouse - - - uses: actions/upload-artifact@v3 - with: - path: ./wheelhouse/*.whl - - build_sdist: - name: Build source distribution - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - with: - submodules: "recursive" - - uses: actions/setup-python@v3 - with: - python-version: "3.8" - - name: Install dependencies - run: | - python -m pip install --upgrade pip build - python -m pip install -e .[all] - - name: Build source distribution - run: | - python -m build --sdist - - uses: actions/upload-artifact@v3 - with: - path: ./dist/*.tar.gz - - release: - name: Release - needs: [build_wheels, build_sdist] - runs-on: ubuntu-latest - - steps: - - uses: actions/download-artifact@v3 - with: - name: artifact - path: dist - - uses: softprops/action-gh-release@v1 - with: - files: dist/* - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/build-docker.yaml b/.github/workflows/build-docker.yaml deleted file mode 100644 index 750b91e1f..000000000 --- a/.github/workflows/build-docker.yaml +++ /dev/null @@ -1,50 +0,0 @@ -name: Build Docker - -on: workflow_dispatch - -permissions: - contents: write - packages: write - -jobs: - docker: - name: Build and push Docker image - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: "recursive" - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - id: docker_build - uses: docker/build-push-action@v4 - with: - context: . - file: "docker/simple/Dockerfile" - push: ${{ startsWith(github.ref, 'refs/tags/') }} - pull: true - platforms: linux/amd64,linux/arm64 - tags: | - ghcr.io/abetlen/llama-cpp-python:latest - ghcr.io/abetlen/llama-cpp-python:${{ github.ref_name }} - build-args: | - BUILDKIT_INLINE_CACHE=1 - - - name: Publish to GitHub Tag - if: steps.docker_build.outputs.digest && startsWith(github.ref, 'refs/tags/') - run: | - echo "Docker image published for tag: ${{ github.ref_name }}" diff --git a/.github/workflows/build-wheels-cuda.yaml b/.github/workflows/build-wheels-cuda.yaml index a222dceb4..158a75c75 100644 --- a/.github/workflows/build-wheels-cuda.yaml +++ b/.github/workflows/build-wheels-cuda.yaml @@ -20,8 +20,8 @@ jobs: id: set-matrix run: | $matrix = @{ - 'os' = @('ubuntu-20.04', 'windows-latest') - 'pyver' = @("3.10", "3.11", "3.12") + 'os' = @('windows-latest') + 'pyver' = @("3.8", "3.10") 'cuda' = @("12.1.1", "12.2.2", "12.3.2") 'releasetag' = @("basic") } diff --git a/.github/workflows/build-wheels-metal.yaml b/.github/workflows/build-wheels-metal.yaml deleted file mode 100644 index 2cca47786..000000000 --- a/.github/workflows/build-wheels-metal.yaml +++ /dev/null @@ -1,87 +0,0 @@ -name: Build Wheels (Metal) - -on: workflow_dispatch - -permissions: - contents: write - -jobs: - define_matrix: - name: Define Build Matrix - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} - defaults: - run: - shell: pwsh - - steps: - - name: Define Job Output - id: set-matrix - run: | - $matrix = @{ - 'os' = @('macos-11', 'macos-12', 'macos-13') - 'pyver' = @('3.10', '3.11', '3.12') - } - - $matrixOut = ConvertTo-Json $matrix -Compress - Write-Output ('matrix=' + $matrixOut) >> $env:GITHUB_OUTPUT - - build_wheels: - name: ${{ matrix.os }} Python ${{ matrix.pyver }} - needs: define_matrix - runs-on: ${{ matrix.os }} - strategy: - matrix: ${{ fromJSON(needs.define_matrix.outputs.matrix) }} - env: - OSVER: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 - with: - submodules: "recursive" - - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.pyver }} - - - name: Install Dependencies - run: | - python -m pip install build wheel cmake - - - name: Build Wheel - run: | - XCODE15PATH="/Applications/Xcode_15.0.app/Contents/Developer" - XCODE15BINPATH="${XCODE15PATH}/Toolchains/XcodeDefault.xctoolchain/usr/bin" - export CMAKE_ARGS="-DLLAMA_NATIVE=off -DLLAMA_METAL=on" - [[ "$OSVER" == "macos-13" ]] && export CC="${XCODE15BINPATH}/cc" && export CXX="${XCODE15BINPATH}/c++" && export MACOSX_DEPLOYMENT_TARGET="13.0" - [[ "$OSVER" == "macos-12" ]] && export MACOSX_DEPLOYMENT_TARGET="12.0" - [[ "$OSVER" == "macos-11" ]] && export MACOSX_DEPLOYMENT_TARGET="11.0" - - export CMAKE_OSX_ARCHITECTURES="arm64" && export ARCHFLAGS="-arch arm64" - VERBOSE=1 python -m build --wheel - - if [[ "$OSVER" == "macos-13" ]]; then - export SDKROOT="${XCODE15PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk" - export MACOSX_DEPLOYMENT_TARGET="14.0" - VERBOSE=1 python -m build --wheel - fi - - for file in ./dist/*.whl; do cp "$file" "${file/arm64.whl/aarch64.whl}"; done - - export CMAKE_OSX_ARCHITECTURES="x86_64" && export CMAKE_ARGS="-DLLAMA_NATIVE=off -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_FMA=off -DLLAMA_F16C=off -DLLAMA_METAL=on" && export ARCHFLAGS="-arch x86_64" - VERBOSE=1 python -m build --wheel - - if [[ "$OSVER" == "macos-13" ]]; then - export SDKROOT="${XCODE15PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk" - export MACOSX_DEPLOYMENT_TARGET="14.0" - VERBOSE=1 python -m build --wheel - fi - - - uses: softprops/action-gh-release@v1 - with: - files: dist/* - # set release name to -metal - tag_name: ${{ github.ref_name }}-metal - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/generate-index-from-release.yaml b/.github/workflows/generate-index-from-release.yaml deleted file mode 100644 index 9042d6cfe..000000000 --- a/.github/workflows/generate-index-from-release.yaml +++ /dev/null @@ -1,48 +0,0 @@ -name: Wheels Index - -on: - # Trigger on any new release - release: - types: [published] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false - -jobs: - # Single deploy job since we're just deploying - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Pages - uses: actions/configure-pages@v4 - - name: Build - run: | - ./scripts/releases-to-pep-503.sh index/whl/cpu '^[v]?[0-9]+\.[0-9]+\.[0-9]+$' - ./scripts/releases-to-pep-503.sh index/whl/cu121 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu121$' - ./scripts/releases-to-pep-503.sh index/whl/cu122 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu122$' - ./scripts/releases-to-pep-503.sh index/whl/metal '^[v]?[0-9]+\.[0-9]+\.[0-9]+-metal$' - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - with: - # Upload entire repository - path: 'index' - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 diff --git a/.github/workflows/publish-to-test.yaml b/.github/workflows/publish-to-test.yaml deleted file mode 100644 index 47e7c40b1..000000000 --- a/.github/workflows/publish-to-test.yaml +++ /dev/null @@ -1,43 +0,0 @@ -# Based on: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ - -name: Publish to TestPyPI - -on: - workflow_dispatch: - inputs: - dev_version: - description: 'Dev version N' - required: true - - -jobs: - build-n-publish: - name: Build and publish - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - with: - submodules: "recursive" - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - name: Append Dev Version to __version__ - run: | - DEV_VERSION=${{ github.event.inputs.dev_version }} - CURRENT_VERSION=$(awk -F= '/__version__ =/ {print $2}' llama_cpp/__init__.py | tr -d ' "') - NEW_VERSION="${CURRENT_VERSION}.dev${DEV_VERSION}" - sed -i 's/__version__ = \".*\"/__version__ = \"'"${NEW_VERSION}"'\"/' llama_cpp/__init__.py - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip build - python3 -m pip install -e .[all] - - name: Build source distribution - run: | - python3 -m build --sdist - - name: Publish to Test PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository-url: https://test.pypi.org/legacy/ \ No newline at end of file diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index 1afdd667d..000000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: Publish to PyPI - -# Based on: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ - -on: workflow_dispatch - -jobs: - build-n-publish: - name: Build and publish - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - with: - submodules: "recursive" - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip build - python3 -m pip install -e .[all] - - name: Build source distribution - run: | - python3 -m build --sdist - - name: Publish distribution to PyPI - # TODO: move to tag based releases - # if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/test-pypi.yaml b/.github/workflows/test-pypi.yaml deleted file mode 100644 index cc6a3a725..000000000 --- a/.github/workflows/test-pypi.yaml +++ /dev/null @@ -1,64 +0,0 @@ -name: Tests for PyPI package - -on: workflow_dispatch - -jobs: - build-linux: - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] - - steps: - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip - python3 -m pip install --verbose llama-cpp-python[all] - - name: Test with pytest - run: | - python3 -c "import llama_cpp" - - build-windows: - - runs-on: windows-latest - strategy: - matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] - - steps: - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip - python3 -m pip install --verbose llama-cpp-python[all] - - name: Test with pytest - run: | - python3 -c "import llama_cpp" - - build-macos: - - runs-on: macos-latest - strategy: - matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] - - steps: - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip - python3 -m pip install --verbose llama-cpp-python[all] - - name: Test with pytest - run: | - python3 -c "import llama_cpp" \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 77df54697..000000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,126 +0,0 @@ -name: Tests - -on: - pull_request: - branches: - - main - push: - branches: - - main - -jobs: - build-linux: - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - - steps: - - uses: actions/checkout@v4 - with: - submodules: "recursive" - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip - python3 -m pip install .[all] -v - - name: Test with pytest - run: | - python3 -m pytest - - build-windows: - - runs-on: windows-latest - strategy: - matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - - steps: - - uses: actions/checkout@v3 - with: - submodules: "recursive" - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip - python3 -m pip install .[all] -v - - name: Test with pytest - run: | - python3 -m pytest - - build-macos: - - runs-on: macos-latest - strategy: - matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - - steps: - - uses: actions/checkout@v3 - with: - submodules: "recursive" - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip - python3 -m pip install .[all] --verbose - - name: Test with pytest - run: | - python3 -m pytest - - # build-linux-opencl: - - # runs-on: ubuntu-latest - - # steps: - # - uses: actions/checkout@v3 - # with: - # submodules: "recursive" - # - name: Set up Python 3.8 - # uses: actions/setup-python@v4 - # with: - # python-version: "3.8" - # - name: Set up OpenCL & CLBlast - # run: | - # wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null - # echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list - # sudo apt-get update - # sudo apt-get install -y --no-install-recommends llvm intel-oneapi-runtime-opencl intel-oneapi-runtime-compilers libclblast-dev - # - name: Install dependencies - # run: | - # python3 -m pip install --upgrade pip - # CMAKE_ARGS="-DLLAMA_CLBLAST=on" python3 -m pip install .[all] --verbose - # - name: Test with pytest - # run: | - # python3 -m pytest - - - build-macos-metal: - - runs-on: macos-latest - - steps: - - uses: actions/checkout@v3 - with: - submodules: "recursive" - - name: Set up Python 3.8 - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip - CMAKE_ARGS="-DLLAMA_METAL=on" python3 -m pip install .[all] --verbose - - name: Test with pytest - run: | - python3 -m pytest diff --git a/.github/workflows/workflows.zip b/.github/workflows/workflows.zip new file mode 100755 index 000000000..74172b14f Binary files /dev/null and b/.github/workflows/workflows.zip differ