From 18a075b2a3bcd9083bb0c3fea12b6b7d067882c7 Mon Sep 17 00:00:00 2001 From: jinbridge <2635480475@qq.com> Date: Sun, 8 Oct 2023 15:55:14 +0800 Subject: [PATCH 01/12] CICD: init release zip yaml --- .github/workflows/manually-release-zip.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/manually-release-zip.yml diff --git a/.github/workflows/manually-release-zip.yml b/.github/workflows/manually-release-zip.yml new file mode 100644 index 00000000000..0f60954a0b8 --- /dev/null +++ b/.github/workflows/manually-release-zip.yml @@ -0,0 +1,14 @@ +name: Manually Release Portable Executable Zip + +on: + workflow_dispatch: + +jobs: + build-zip: + runs-on: [self-hosted, windows] + + steps: + - uses: actions/checkout@v3 + - name: run bat + run: ./python/llm/portable-executable/setup.bat + shell: pwsh From e60e04a89a77c5ebee35978044c51bf2841aaa80 Mon Sep 17 00:00:00 2001 From: jinbridge <2635480475@qq.com> Date: Mon, 9 Oct 2023 19:03:56 +0800 Subject: [PATCH 02/12] CICD: refactor release zip yaml --- .../bigdl-release-portable-executable-zip.yml | 24 +++++++++++++++++++ .github/workflows/manually-release-zip.yml | 14 ----------- 2 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/bigdl-release-portable-executable-zip.yml delete mode 100644 .github/workflows/manually-release-zip.yml diff --git a/.github/workflows/bigdl-release-portable-executable-zip.yml b/.github/workflows/bigdl-release-portable-executable-zip.yml new file mode 100644 index 00000000000..7a8d37f3850 --- /dev/null +++ b/.github/workflows/bigdl-release-portable-executable-zip.yml @@ -0,0 +1,24 @@ +name: BigDL Release Portable Executable Zip + +on: + push: + branches: [main] + paths: + - ".github/workflows/bigdl-release-portable-executable-zip.yml" + - "python/llm/portable-executable/**" + pull_request: + branches: [main] + paths: + - ".github/workflows/bigdl-release-portable-executable-zip.yml" + - "python/llm/portable-executable/**" + workflow_dispatch: + +jobs: + build-zip: + runs-on: [self-hosted, llm, windows] + + steps: + - uses: actions/checkout@v3 + - name: run bat + run: ./python/llm/portable-executable/setup.bat + shell: pwsh diff --git a/.github/workflows/manually-release-zip.yml b/.github/workflows/manually-release-zip.yml deleted file mode 100644 index 0f60954a0b8..00000000000 --- a/.github/workflows/manually-release-zip.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Manually Release Portable Executable Zip - -on: - workflow_dispatch: - -jobs: - build-zip: - runs-on: [self-hosted, windows] - - steps: - - uses: actions/checkout@v3 - - name: run bat - run: ./python/llm/portable-executable/setup.bat - shell: pwsh From dc29a8ea33d72c893630e25f0c2eb5fbb62c93bc Mon Sep 17 00:00:00 2001 From: jinbridge <2635480475@qq.com> Date: Mon, 9 Oct 2023 19:11:36 +0800 Subject: [PATCH 03/12] fix: using powershell instead of pwsh --- .github/workflows/bigdl-release-portable-executable-zip.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bigdl-release-portable-executable-zip.yml b/.github/workflows/bigdl-release-portable-executable-zip.yml index 7a8d37f3850..905cf8f996f 100644 --- a/.github/workflows/bigdl-release-portable-executable-zip.yml +++ b/.github/workflows/bigdl-release-portable-executable-zip.yml @@ -21,4 +21,4 @@ jobs: - uses: actions/checkout@v3 - name: run bat run: ./python/llm/portable-executable/setup.bat - shell: pwsh + shell: powershell From 49da19929974a0494bb07800aad0cc8caf5d9839 Mon Sep 17 00:00:00 2001 From: jinbridge <2635480475@qq.com> Date: Mon, 9 Oct 2023 19:20:31 +0800 Subject: [PATCH 04/12] fix: try to fix bat path --- .github/workflows/bigdl-release-portable-executable-zip.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bigdl-release-portable-executable-zip.yml b/.github/workflows/bigdl-release-portable-executable-zip.yml index 905cf8f996f..895288f8383 100644 --- a/.github/workflows/bigdl-release-portable-executable-zip.yml +++ b/.github/workflows/bigdl-release-portable-executable-zip.yml @@ -20,5 +20,5 @@ jobs: steps: - uses: actions/checkout@v3 - name: run bat - run: ./python/llm/portable-executable/setup.bat + run: '& $env:GITHUB_ACTION_PATH/python/llm/portable-executable/setup.bat' shell: powershell From f646c2d997eb95d6cbd28a26d7fd7a160db16cf9 Mon Sep 17 00:00:00 2001 From: jinbridge <2635480475@qq.com> Date: Mon, 9 Oct 2023 19:26:04 +0800 Subject: [PATCH 05/12] update bat file position --- .github/workflows/bigdl-release-portable-executable-zip.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bigdl-release-portable-executable-zip.yml b/.github/workflows/bigdl-release-portable-executable-zip.yml index 895288f8383..6e25a931a9c 100644 --- a/.github/workflows/bigdl-release-portable-executable-zip.yml +++ b/.github/workflows/bigdl-release-portable-executable-zip.yml @@ -20,5 +20,5 @@ jobs: steps: - uses: actions/checkout@v3 - name: run bat - run: '& $env:GITHUB_ACTION_PATH/python/llm/portable-executable/setup.bat' + run: '& $env:GITHUB_ACTION_PATH/python/llm/portable-zip/setup.bat' shell: powershell From 0897bef5c3a578dbf567a779716cb0400b689cf7 Mon Sep 17 00:00:00 2001 From: jinbridge <2635480475@qq.com> Date: Mon, 9 Oct 2023 19:28:44 +0800 Subject: [PATCH 06/12] fix: try to fix bat path --- .github/workflows/bigdl-release-portable-executable-zip.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bigdl-release-portable-executable-zip.yml b/.github/workflows/bigdl-release-portable-executable-zip.yml index 6e25a931a9c..17cc7ec39a1 100644 --- a/.github/workflows/bigdl-release-portable-executable-zip.yml +++ b/.github/workflows/bigdl-release-portable-executable-zip.yml @@ -20,5 +20,5 @@ jobs: steps: - uses: actions/checkout@v3 - name: run bat - run: '& $env:GITHUB_ACTION_PATH/python/llm/portable-zip/setup.bat' + run: '& ./python/llm/portable-zip/setup.bat' shell: powershell From a79f5d6b968bab3183046ee75bac7889ae180572 Mon Sep 17 00:00:00 2001 From: jinbridge <2635480475@qq.com> Date: Mon, 9 Oct 2023 19:48:49 +0800 Subject: [PATCH 07/12] fix: compress path in setup.bat --- python/llm/portable-zip/setup.bat | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/python/llm/portable-zip/setup.bat b/python/llm/portable-zip/setup.bat index 199902143ca..95217113811 100644 --- a/python/llm/portable-zip/setup.bat +++ b/python/llm/portable-zip/setup.bat @@ -1,23 +1,23 @@ :: download python and extract zip -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" +powershell -Command "Start-BitsTransfer -Source https://www.python.org/ftp/python/3.9.13/python-3.9.13-embed-amd64.zip -Destination .\python\llm\portable-zip\python-3.9.13-embed-amd64.zip" +powershell -Command "Expand-Archive .\python\llm\portable-zip\python-3.9.13-embed-amd64.zip -DestinationPath .\python\llm\portable-zip\python-embed" del .\python-3.9.13-embed-amd64.zip -set "python-embed=.\python-embed\python.exe" +set "python-embed=.\python\llm\portable-zip\python-embed\python.exe" :: download get-pip.py and install -powershell -Command "Invoke-WebRequest https://bootstrap.pypa.io/get-pip.py -OutFile .\python-embed\get-pip.py" -%python-embed% .\python-embed\get-pip.py +powershell -Command "Invoke-WebRequest https://bootstrap.pypa.io/get-pip.py -OutFile .\python\llm\portable-zip\python-embed\get-pip.py" +%python-embed% .\python\llm\portable-zip\python-embed\get-pip.py :: enable run site.main() automatically -cd .\python-embed +@REM cd .\python\llm\portable-zip\python-embed set "search=#import site" set "replace=import site" -powershell -Command "(gc python39._pth) -replace '%search%', '%replace%' | Out-File -encoding ASCII python39._pth" -cd .. +powershell -Command "(gc .\python\llm\portable-zip\python-embed\python39._pth) -replace '%search%', '%replace%' | Out-File -encoding ASCII .\python\llm\portable-zip\python-embed\python39._pth" +@REM cd .. :: install pip packages %python-embed% -m pip install bigdl-llm[all] transformers_stream_generator tiktoken einops colorama :: compress the python and scripts -powershell -Command "Compress-Archive -Path '.\python-embed', '.\chat.bat', '.\chat.py', '.\README.md' -DestinationPath .\bigdl-llm.zip" +powershell -Command "Compress-Archive -Path '.\python\llm\portable-zip\python-embed', '.\python\llm\portable-zip\chat.bat', '.\python\llm\portable-zip\chat.py', '.\python\llm\portable-zip\README.md' -DestinationPath .\python\llm\portable-zip\bigdl-llm.zip" From f1b25ffddcff076b1d8f19a081687888b1a95dd6 Mon Sep 17 00:00:00 2001 From: jinbridge <2635480475@qq.com> Date: Thu, 2 Nov 2023 00:44:51 +0800 Subject: [PATCH 08/12] CICD: add ui version build script --- .../bigdl-release-portable-executable-zip.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bigdl-release-portable-executable-zip.yml b/.github/workflows/bigdl-release-portable-executable-zip.yml index 17cc7ec39a1..4b60f7119c7 100644 --- a/.github/workflows/bigdl-release-portable-executable-zip.yml +++ b/.github/workflows/bigdl-release-portable-executable-zip.yml @@ -14,7 +14,7 @@ on: workflow_dispatch: jobs: - build-zip: + build-zip-cli: runs-on: [self-hosted, llm, windows] steps: @@ -22,3 +22,12 @@ jobs: - name: run bat run: '& ./python/llm/portable-zip/setup.bat' shell: powershell + + build-zip-gui: + runs-on: [self-hosted, llm, windows] + + steps: + - uses: actions/checkout@v3 + - name: run bat + run: '& ./python/llm/portable-zip/setup.bat --ui' + shell: powershell From 236a038274f88e58c5e746438ccf391a372d9e61 Mon Sep 17 00:00:00 2001 From: jinbridge <2635480475@qq.com> Date: Thu, 2 Nov 2023 01:01:26 +0800 Subject: [PATCH 09/12] fix: setup.bat --- .../bigdl-release-portable-executable-zip.yml | 4 ++-- python/llm/portable-zip/setup.bat | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/bigdl-release-portable-executable-zip.yml b/.github/workflows/bigdl-release-portable-executable-zip.yml index 4b60f7119c7..508cfcdd130 100644 --- a/.github/workflows/bigdl-release-portable-executable-zip.yml +++ b/.github/workflows/bigdl-release-portable-executable-zip.yml @@ -20,7 +20,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: run bat - run: '& ./python/llm/portable-zip/setup.bat' + run: '& cd ./python/llm/portable-zip; ./setup.bat' shell: powershell build-zip-gui: @@ -29,5 +29,5 @@ jobs: steps: - uses: actions/checkout@v3 - name: run bat - run: '& ./python/llm/portable-zip/setup.bat --ui' + run: '& cd ./python/llm/portable-zip; ./setup.bat --ui' shell: powershell diff --git a/python/llm/portable-zip/setup.bat b/python/llm/portable-zip/setup.bat index 056420adc6c..b509a2b2eb6 100644 --- a/python/llm/portable-zip/setup.bat +++ b/python/llm/portable-zip/setup.bat @@ -1,20 +1,20 @@ :: download python and extract zip -powershell -Command "Start-BitsTransfer -Source https://www.python.org/ftp/python/3.9.13/python-3.9.13-embed-amd64.zip -Destination .\python\llm\portable-zip\python-3.9.13-embed-amd64.zip" -powershell -Command "Expand-Archive .\python\llm\portable-zip\python-3.9.13-embed-amd64.zip -DestinationPath .\python\llm\portable-zip\python-embed" +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 -set "python-embed=.\python\llm\portable-zip\python-embed\python.exe" +set "python-embed=.\python-embed\python.exe" :: download get-pip.py and install -powershell -Command "Invoke-WebRequest https://bootstrap.pypa.io/get-pip.py -OutFile .\python\llm\portable-zip\python-embed\get-pip.py" -%python-embed% .\python\llm\portable-zip\python-embed\get-pip.py +powershell -Command "Invoke-WebRequest https://bootstrap.pypa.io/get-pip.py -OutFile .\python-embed\get-pip.py" +%python-embed% .\python-embed\get-pip.py :: enable run site.main() automatically -@REM cd .\python\llm\portable-zip\python-embed +cd .\python-embed set "search=#import site" set "replace=import site" -powershell -Command "(gc .\python\llm\portable-zip\python-embed\python39._pth) -replace '%search%', '%replace%' | Out-File -encoding ASCII .\python\llm\portable-zip\python-embed\python39._pth" -@REM cd .. +powershell -Command "(gc python39._pth) -replace '%search%', '%replace%' | Out-File -encoding ASCII python39._pth" +cd .. :: install pip packages %python-embed% -m pip install --pre --upgrade bigdl-llm[all] @@ -29,4 +29,4 @@ if "%1"=="--ui" ( powershell -Command "Compress-Archive -Path '.\python-embed', '.\chat-ui.bat', '.\README.md' -DestinationPath .\bigdl-llm-ui.zip" ) else ( powershell -Command "Compress-Archive -Path '.\python-embed', '.\chat.bat', '.\chat.py', '.\README.md' -DestinationPath .\bigdl-llm.zip" -) +) \ No newline at end of file From da83bf8a27a99d5d2c827c2a45d362161b672dfc Mon Sep 17 00:00:00 2001 From: jinbridge <2635480475@qq.com> Date: Thu, 2 Nov 2023 23:49:16 +0800 Subject: [PATCH 10/12] cicd: add upload artifact --- .../workflows/bigdl-release-portable-executable-zip.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/bigdl-release-portable-executable-zip.yml b/.github/workflows/bigdl-release-portable-executable-zip.yml index 508cfcdd130..be659968d6f 100644 --- a/.github/workflows/bigdl-release-portable-executable-zip.yml +++ b/.github/workflows/bigdl-release-portable-executable-zip.yml @@ -22,6 +22,10 @@ jobs: - name: run bat run: '& cd ./python/llm/portable-zip; ./setup.bat' shell: powershell + - uses: actions/upload-artifact@v3 + with: + name: portable-zip + path: ./python/llm/portable-zip/bigdl-llm.zip build-zip-gui: runs-on: [self-hosted, llm, windows] @@ -31,3 +35,7 @@ jobs: - name: run bat run: '& cd ./python/llm/portable-zip; ./setup.bat --ui' shell: powershell + - uses: actions/upload-artifact@v3 + with: + name: portable-zip + path: ./python/llm/portable-zip/bigdl-llm-ui.zip From d475d6af3105c5c6fb6fd115ce9dd33ed0d7bf80 Mon Sep 17 00:00:00 2001 From: jinbridge <2635480475@qq.com> Date: Sun, 5 Nov 2023 23:52:01 +0800 Subject: [PATCH 11/12] CICD: sync changes in portable-zip --- python/llm/portable-zip/setup.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/llm/portable-zip/setup.bat b/python/llm/portable-zip/setup.bat index b509a2b2eb6..f0d10e7b52e 100644 --- a/python/llm/portable-zip/setup.bat +++ b/python/llm/portable-zip/setup.bat @@ -26,7 +26,7 @@ if "%1"=="--ui" ( :: compress the python and scripts if "%1"=="--ui" ( - powershell -Command "Compress-Archive -Path '.\python-embed', '.\chat-ui.bat', '.\README.md' -DestinationPath .\bigdl-llm-ui.zip" + powershell -Command "Compress-Archive -Path '.\python-embed', '.\chat-ui.bat', '.\README-ui.md' -DestinationPath .\bigdl-llm-ui.zip" ) else ( - powershell -Command "Compress-Archive -Path '.\python-embed', '.\chat.bat', '.\chat.py', '.\README.md' -DestinationPath .\bigdl-llm.zip" + powershell -Command "Compress-Archive -Path '.\python-embed', '.\chat.bat', '.\chat.py', '.\kv_cache.py' , '.\README.md' -DestinationPath .\bigdl-llm.zip" ) \ No newline at end of file From 01b2e8799bea7a0043e042914e7014e77d57705e Mon Sep 17 00:00:00 2001 From: jinbridge <2635480475@qq.com> Date: Mon, 6 Nov 2023 13:39:17 +0800 Subject: [PATCH 12/12] Fix: cannot find kv_cache --- python/llm/portable-zip/chat.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/llm/portable-zip/chat.py b/python/llm/portable-zip/chat.py index cecf9700603..2eb69d268a1 100644 --- a/python/llm/portable-zip/chat.py +++ b/python/llm/portable-zip/chat.py @@ -43,6 +43,8 @@ import argparse import sys +sys.path.append(".") + # todo: support more model class from transformers import AutoModel, AutoModelForCausalLM, AutoTokenizer, AutoConfig from transformers import TextIteratorStreamer