From 1340ec9ae1c9a0804e232af7b7faed9fdb35381f Mon Sep 17 00:00:00 2001 From: jinbridge <2635480475@qq.com> Date: Fri, 8 Mar 2024 15:58:37 +0800 Subject: [PATCH] use python=3.11 instead --- .../workflows/bigdl-build-portable-zip.yml | 78 +++++++++---------- python/llm/portable-zip/.gitignore | 2 +- python/llm/portable-zip/setup.bat | 20 +++-- 3 files changed, 52 insertions(+), 48 deletions(-) diff --git a/.github/workflows/bigdl-build-portable-zip.yml b/.github/workflows/bigdl-build-portable-zip.yml index 66e81666d6f..4e91c2c9a8a 100644 --- a/.github/workflows/bigdl-build-portable-zip.yml +++ b/.github/workflows/bigdl-build-portable-zip.yml @@ -9,53 +9,53 @@ on: jobs: - build-cpython: - runs-on: windows-latest - steps: - - uses: ilammy/msvc-dev-cmd@v1 - with: - toolset: 14.2 - - uses: actions/checkout@v4 - with: - repository: 'python/cpython' - ref: '3.9' - - name: Replace with SQLite 3.45.1 - # this is to fix security issue - # according to cpython, 3.9 is only accepting security patches - # so we need to manually replace it with sqlite 3.45.1 - shell: bash - run: | - cd ./PCbuild - sed -i 's/sqlite-3.37.2.0/sqlite-3.45.1.0/g' get_externals.bat - sed -i 's/sqlite-3.37.2.0/sqlite-3.45.1.0/g' python.props - cd .. - - name: Build cpython - run: | - ./Tools/msi/buildrelease.bat -x64 --skip-doc --skip-nuget --skip-msi - - name: Rename artifact - shell: bash - run: | - cd ./PCbuild/amd64/en-us - ls | xargs -I {} mv {} cpython-embed-zip.zip - cd ../../.. - - uses: actions/upload-artifact@v4 - with: - name: cpython-3.9-embed-zip - path: ./PCbuild/amd64/en-us/cpython-embed-zip.zip + # build-cpython: + # runs-on: windows-latest + # steps: + # - uses: ilammy/msvc-dev-cmd@v1 + # with: + # toolset: 14.2 + # - uses: actions/checkout@v4 + # with: + # repository: 'python/cpython' + # ref: '3.9' + # - name: Replace with SQLite 3.45.1 + # # this is to fix security issue + # # according to cpython, 3.9 is only accepting security patches + # # so we need to manually replace it with sqlite 3.45.1 + # shell: bash + # run: | + # cd ./PCbuild + # sed -i 's/sqlite-3.37.2.0/sqlite-3.45.1.0/g' get_externals.bat + # sed -i 's/sqlite-3.37.2.0/sqlite-3.45.1.0/g' python.props + # cd .. + # - name: Build cpython + # run: | + # ./Tools/msi/buildrelease.bat -x64 --skip-doc --skip-nuget --skip-msi + # - name: Rename artifact + # shell: bash + # run: | + # cd ./PCbuild/amd64/en-us + # ls | xargs -I {} mv {} cpython-embed-zip.zip + # cd ../../.. + # - uses: actions/upload-artifact@v4 + # with: + # name: cpython-3.9-embed-zip + # path: ./PCbuild/amd64/en-us/cpython-embed-zip.zip build-portable-zip: - needs: build-cpython + # needs: build-cpython runs-on: windows-latest steps: - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 - with: - name: cpython-3.9-embed-zip - path: ./python/llm/portable-zip/ + # - uses: actions/download-artifact@v4 + # with: + # name: cpython-3.9-embed-zip + # path: ./python/llm/portable-zip/ - name: Build Portable Zip shell: cmd run: | cd .\python\llm\portable-zip - setup.bat --python-zip + setup.bat cd ..\..\.. - uses: actions/upload-artifact@v4 with: diff --git a/python/llm/portable-zip/.gitignore b/python/llm/portable-zip/.gitignore index db74839fde9..48f7b3cd650 100644 --- a/python/llm/portable-zip/.gitignore +++ b/python/llm/portable-zip/.gitignore @@ -1,4 +1,4 @@ python-embed -bigdl-llm.zip +*.zip *.log *.json \ No newline at end of file diff --git a/python/llm/portable-zip/setup.bat b/python/llm/portable-zip/setup.bat index 5135095d497..2b2177e7095 100644 --- a/python/llm/portable-zip/setup.bat +++ b/python/llm/portable-zip/setup.bat @@ -1,12 +1,15 @@ :: download python and extract zip -if "%1"=="--python-zip" ( - powershell -Command "Expand-Archive .\cpython-embed-zip.zip -DestinationPath .\python-embed" -) else ( - powershell -Command "Start-BitsTransfer -Source https://www.python.org/ftp/python/3.9.13/python-3.9.13-embed-amd64.zip -Destination python-3.9.13-embed-amd64.zip" - powershell -Command "Expand-Archive .\python-3.9.13-embed-amd64.zip -DestinationPath .\python-embed" - del .\python-3.9.13-embed-amd64.zip -) +@REM if "%1"=="--python-zip" ( +@REM powershell -Command "Expand-Archive .\cpython-embed-zip.zip -DestinationPath .\python-embed" +@REM ) else ( +@REM powershell -Command "Start-BitsTransfer -Source https://www.python.org/ftp/python/3.11.8/python-3.11.8-embed-amd64.zip -Destination python-3.11.8-embed-amd64.zip" +@REM powershell -Command "Expand-Archive .\python-3.11.8-embed-amd64.zip -DestinationPath .\python-embed" +@REM del .\python-3.12.2-embed-amd64.zip +@REM ) +@REM powershell -Command "Start-BitsTransfer -Source https://www.python.org/ftp/python/3.11.8/python-3.11.8-embed-amd64.zip -Destination python-3.11.8-embed-amd64.zip" +powershell -Command "Expand-Archive .\python-3.11.8-embed-amd64.zip -DestinationPath .\python-embed" +del .\python-3.12.2-embed-amd64.zip set "python-embed=.\python-embed\python.exe" @@ -18,11 +21,12 @@ powershell -Command "Invoke-WebRequest https://bootstrap.pypa.io/get-pip.py -Out cd .\python-embed set "search=#import site" set "replace=import site" -powershell -Command "(gc python39._pth) -replace '%search%', '%replace%' | Out-File -encoding ASCII python39._pth" +powershell -Command "(gc python311._pth) -replace '%search%', '%replace%' | Out-File -encoding ASCII python311._pth" cd .. :: install pip packages %python-embed% -m pip install --pre --upgrade bigdl-llm[all] +%python-embed% -m pip install transformers==4.36.2 %python-embed% -m pip install transformers_stream_generator tiktoken einops colorama if "%1"=="--ui" (