Skip to content

Commit

Permalink
use python=3.11 instead
Browse files Browse the repository at this point in the history
  • Loading branch information
JinBridger committed Mar 8, 2024
1 parent 4a45620 commit 1340ec9
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 48 deletions.
78 changes: 39 additions & 39 deletions .github/workflows/bigdl-build-portable-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion python/llm/portable-zip/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
python-embed
bigdl-llm.zip
*.zip
*.log
*.json
20 changes: 12 additions & 8 deletions python/llm/portable-zip/setup.bat
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -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" (
Expand Down

0 comments on commit 1340ec9

Please sign in to comment.