From f4fadcc1543ed5be4cfb457efa82c99b3dc4f726 Mon Sep 17 00:00:00 2001 From: Simplegram <34500695+Simplegram@users.noreply.github.com> Date: Tue, 29 Apr 2025 22:30:57 +0700 Subject: [PATCH 1/4] Add: venv setup step --- .github/workflows/build-wheels-cuda-win.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-wheels-cuda-win.yml b/.github/workflows/build-wheels-cuda-win.yml index 156c99fd9..3c8a6db21 100644 --- a/.github/workflows/build-wheels-cuda-win.yml +++ b/.github/workflows/build-wheels-cuda-win.yml @@ -73,6 +73,10 @@ jobs: with: python-version: ${{ matrix.pyver }} + - name: Setup uv venv + run: | + uv venv + - name: Install Dependencies run: | git config --system core.longpaths true From 0d6202ae575e2e3af8f9c4543e10b5c25aaac65c Mon Sep 17 00:00:00 2001 From: Simplegram <34500695+Simplegram@users.noreply.github.com> Date: Tue, 29 Apr 2025 22:41:33 +0700 Subject: [PATCH 2/4] Add: curl installation for linux and windows --- .github/workflows/test.yaml | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 95f6e5a27..66f1369c8 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -50,16 +50,24 @@ jobs: with: path: ~/.cache/huggingface/hub key: ${{ runner.os }}-model-${{ env.REPO_ID }}-${{ env.MODEL_FILE }} + + - name: Install curl dependencies + run: | + sudo apt update && + sudo apt upgrade -y && + sudo apt install -y curl libcurl4-openssl-dev + shell: bash # explicitly specifying bash shell + - name: Install dependencies (Linux/MacOS) run: | python -m pip install --upgrade pip python -m pip install uv python -m uv pip install -e .[all] --verbose shell: bash + - name: Test with pytest run: | python -m pytest - build-windows: needs: download-model runs-on: windows-latest @@ -70,7 +78,7 @@ jobs: - uses: actions/checkout@v4 with: submodules: "recursive" - + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: @@ -83,13 +91,24 @@ jobs: path: ~/.cache/huggingface/hub key: ${{ runner.os }}-model-${{ env.REPO_ID }}-${{ env.MODEL_FILE }} + - name: Install Chocolatey + run: | + Set-ExecutionPolicy Bypass -Scope Process -Force; ` + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; ` + Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + shell: pwsh # important: use powershell + + - name: Install curl using Chocolatey + run: choco install curl -y + shell: pwsh + - name: Install dependencies (Windows) run: | python -m pip install --upgrade pip python -m pip install uv python -m uv pip install -e .[all] --verbose shell: cmd - + - name: Test with pytest run: | python -m pytest From aca3ccdb7a9a4902528cb217f9a7d5b3c9075c53 Mon Sep 17 00:00:00 2001 From: Simplegram <34500695+Simplegram@users.noreply.github.com> Date: Tue, 29 Apr 2025 22:48:53 +0700 Subject: [PATCH 3/4] Change: ignore curl windows and set env curl linux --- .github/workflows/test.yaml | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 66f1369c8..3ce77fe78 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -56,13 +56,19 @@ jobs: sudo apt update && sudo apt upgrade -y && sudo apt install -y curl libcurl4-openssl-dev - shell: bash # explicitly specifying bash shell - + shell: bash # explicitly specifying bash shell' + + - name: Find CURL paths (Linux) + run: | + echo "CURL_INCLUDE_DIR=/usr/include/curl" >> $GITHUB_ENV + echo "CURL_LIBRARY=/usr/lib/x86_64-linux-gnu/libcurl.so" >> $GITHUB_ENV + shell: bash + - name: Install dependencies (Linux/MacOS) run: | python -m pip install --upgrade pip python -m pip install uv - python -m uv pip install -e .[all] --verbose + python -m uv pip install -e .[all] --verbose --config-settings="cmake.define.CURL_INCLUDE_DIR=$CURL_INCLUDE_DIR" --config-settings="cmake.define.CURL_LIBRARY=$CURL_LIBRARY" shell: bash - name: Test with pytest @@ -91,22 +97,11 @@ jobs: path: ~/.cache/huggingface/hub key: ${{ runner.os }}-model-${{ env.REPO_ID }}-${{ env.MODEL_FILE }} - - name: Install Chocolatey - run: | - Set-ExecutionPolicy Bypass -Scope Process -Force; ` - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; ` - Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) - shell: pwsh # important: use powershell - - - name: Install curl using Chocolatey - run: choco install curl -y - shell: pwsh - - name: Install dependencies (Windows) run: | python -m pip install --upgrade pip python -m pip install uv - python -m uv pip install -e .[all] --verbose + python -m uv pip install -e .[all] --verbose --config-settings="cmake.define.LLAMA_CURL=OFF" shell: cmd - name: Test with pytest From 3243f62f18466bf11f73389416441f400ccfea71 Mon Sep 17 00:00:00 2001 From: Simplegram <34500695+Simplegram@users.noreply.github.com> Date: Tue, 29 Apr 2025 23:12:43 +0700 Subject: [PATCH 4/4] Fix: attempt to fix LP_LP_llama_sampler error --- llama_cpp/_internals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llama_cpp/_internals.py b/llama_cpp/_internals.py index a00c8925a..e163b23ca 100644 --- a/llama_cpp/_internals.py +++ b/llama_cpp/_internals.py @@ -756,7 +756,7 @@ def free_wrapper(sampler: llama_cpp.llama_sampler_p): self.sampler = llama_cpp.llama_sampler_init(ctypes.pointer(sampler_i), None) def get_sampler(self) -> llama_cpp.llama_sampler_p: - return ctypes.pointer(self.sampler) + return self.sampler class LlamaSampler: