From 68bdec12c00182bebd386346c2ab3576d78c0f3b Mon Sep 17 00:00:00 2001 From: 505030475 <505030475@qq.com> Date: Sun, 7 May 2023 16:47:20 +0800 Subject: [PATCH] try jittor build --- .github/workflows/build-with-jittorllms.yml | 44 +++++++++++++++++++++ docs/GithubAction+JittorLLMs | 34 ++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 .github/workflows/build-with-jittorllms.yml create mode 100644 docs/GithubAction+JittorLLMs diff --git a/.github/workflows/build-with-jittorllms.yml b/.github/workflows/build-with-jittorllms.yml new file mode 100644 index 000000000..c0ce126a9 --- /dev/null +++ b/.github/workflows/build-with-jittorllms.yml @@ -0,0 +1,44 @@ +# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages +name: Create and publish a Docker image for ChatGLM support + +on: + push: + branches: + - 'master' + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }}_jittorllms + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + push: true + file: docs/GithubAction+JittorLLMs + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/docs/GithubAction+JittorLLMs b/docs/GithubAction+JittorLLMs new file mode 100644 index 000000000..4f0e66ba8 --- /dev/null +++ b/docs/GithubAction+JittorLLMs @@ -0,0 +1,34 @@ +# 从NVIDIA源,从而支持显卡运损(检查宿主的nvidia-smi中的cuda版本必须>=11.3) +FROM nvidia/cuda:11.3.1-runtime-ubuntu20.04 +ARG useProxyNetwork='' +RUN apt-get update +RUN apt-get install -y curl proxychains curl g++ +RUN apt-get install -y git python python3 python-dev python3-dev --fix-missing + +# use python3 as the system default python +RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.8 + +# 下载pytorch +RUN python3 -m pip install torch --extra-index-url https://download.pytorch.org/whl/cu113 + +# 下载分支 +WORKDIR /gpt +RUN git clone https://github.com/binary-husky/chatgpt_academic.git -b jittor +WORKDIR /gpt/chatgpt_academic +RUN python3 -m pip install -r requirements.txt +RUN python3 -m pip install -r request_llm/requirements_chatglm.txt +RUN python3 -m pip install -r request_llm/requirements_newbing.txt +RUN python3 -m pip install -r request_llm/requirements_jittorllms.txt -i https://pypi.jittor.org/simple -I + +# 下载JittorLLMs +RUN git clone https://github.com/binary-husky/JittorLLMs.git --depth 1 request_llm/jittorllms + +# 禁用缓存,确保更新代码 +ADD "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" skipcache +RUN git pull + +# 预热Tiktoken模块 +RUN python3 -c 'from check_proxy import warm_up_modules; warm_up_modules()' + +# 启动 +CMD ["python3", "-u", "main.py"]