try jittor build
Browse files
.github/workflows/build-with-jittorllms.yml
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages
|
2 |
+
name: Create and publish a Docker image for ChatGLM support
|
3 |
+
|
4 |
+
on:
|
5 |
+
push:
|
6 |
+
branches:
|
7 |
+
- 'master'
|
8 |
+
|
9 |
+
env:
|
10 |
+
REGISTRY: ghcr.io
|
11 |
+
IMAGE_NAME: ${{ github.repository }}_jittorllms
|
12 |
+
|
13 |
+
jobs:
|
14 |
+
build-and-push-image:
|
15 |
+
runs-on: ubuntu-latest
|
16 |
+
permissions:
|
17 |
+
contents: read
|
18 |
+
packages: write
|
19 |
+
|
20 |
+
steps:
|
21 |
+
- name: Checkout repository
|
22 |
+
uses: actions/checkout@v3
|
23 |
+
|
24 |
+
- name: Log in to the Container registry
|
25 |
+
uses: docker/login-action@v2
|
26 |
+
with:
|
27 |
+
registry: ${{ env.REGISTRY }}
|
28 |
+
username: ${{ github.actor }}
|
29 |
+
password: ${{ secrets.GITHUB_TOKEN }}
|
30 |
+
|
31 |
+
- name: Extract metadata (tags, labels) for Docker
|
32 |
+
id: meta
|
33 |
+
uses: docker/metadata-action@v4
|
34 |
+
with:
|
35 |
+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
36 |
+
|
37 |
+
- name: Build and push Docker image
|
38 |
+
uses: docker/build-push-action@v4
|
39 |
+
with:
|
40 |
+
context: .
|
41 |
+
push: true
|
42 |
+
file: docs/GithubAction+JittorLLMs
|
43 |
+
tags: ${{ steps.meta.outputs.tags }}
|
44 |
+
labels: ${{ steps.meta.outputs.labels }}
|
docs/GithubAction+JittorLLMs
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 从NVIDIA源,从而支持显卡运损(检查宿主的nvidia-smi中的cuda版本必须>=11.3)
|
2 |
+
FROM nvidia/cuda:11.3.1-runtime-ubuntu20.04
|
3 |
+
ARG useProxyNetwork=''
|
4 |
+
RUN apt-get update
|
5 |
+
RUN apt-get install -y curl proxychains curl g++
|
6 |
+
RUN apt-get install -y git python python3 python-dev python3-dev --fix-missing
|
7 |
+
|
8 |
+
# use python3 as the system default python
|
9 |
+
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.8
|
10 |
+
|
11 |
+
# 下载pytorch
|
12 |
+
RUN python3 -m pip install torch --extra-index-url https://download.pytorch.org/whl/cu113
|
13 |
+
|
14 |
+
# 下载分支
|
15 |
+
WORKDIR /gpt
|
16 |
+
RUN git clone https://github.com/binary-husky/chatgpt_academic.git -b jittor
|
17 |
+
WORKDIR /gpt/chatgpt_academic
|
18 |
+
RUN python3 -m pip install -r requirements.txt
|
19 |
+
RUN python3 -m pip install -r request_llm/requirements_chatglm.txt
|
20 |
+
RUN python3 -m pip install -r request_llm/requirements_newbing.txt
|
21 |
+
RUN python3 -m pip install -r request_llm/requirements_jittorllms.txt -i https://pypi.jittor.org/simple -I
|
22 |
+
|
23 |
+
# 下载JittorLLMs
|
24 |
+
RUN git clone https://github.com/binary-husky/JittorLLMs.git --depth 1 request_llm/jittorllms
|
25 |
+
|
26 |
+
# 禁用缓存,确保更新代码
|
27 |
+
ADD "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" skipcache
|
28 |
+
RUN git pull
|
29 |
+
|
30 |
+
# 预热Tiktoken模块
|
31 |
+
RUN python3 -c 'from check_proxy import warm_up_modules; warm_up_modules()'
|
32 |
+
|
33 |
+
# 启动
|
34 |
+
CMD ["python3", "-u", "main.py"]
|