diff --git a/.github/workflows/chatglm_linux.yml b/.github/workflows/chatglm_linux.yml new file mode 100644 index 00000000..662fe8e8 --- /dev/null +++ b/.github/workflows/chatglm_linux.yml @@ -0,0 +1,33 @@ +name: chatglm-linux +on: + push: + branches: + - master + - 'feature/**' + paths: + - 'src/**' + - '.github/workflows/chatglm_linux.yml' + pull_request: + branches: [master] + paths: + - 'src/**' + - '.github/workflows/chatglm_linux.yml' + +concurrency: + group: linux-${{ github.ref }} + cancel-in-progress: true +permissions: + contents: read + +jobs: + linux_buil_test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: download + run: ./script/download_model.sh chatglm-6b + - name: build + run: ./script/linux_build.sh + - name: test + run: | + ./build/cli_demo -m chatglm-6b \ No newline at end of file diff --git a/script/download_model.sh b/script/download_model.sh new file mode 100755 index 00000000..ee7bdf15 --- /dev/null +++ b/script/download_model.sh @@ -0,0 +1,11 @@ +model=$1 +mkdir $model +cd $model +# download models +wget -c https://github.com/wangzhaode/mnn-llm/releases/download/$model-mnn/embedding.mnn +wget -c https://github.com/wangzhaode/mnn-llm/releases/download/$model-mnn/lm.mnn +for i in `seq 0 27` +do + wget -c https://github.com/wangzhaode/mnn-llm/releases/download/$model-mnn/block_$i.mnn +done +cd .. \ No newline at end of file diff --git a/script/linux_build.sh b/script/linux_build.sh new file mode 100755 index 00000000..bf40f06b --- /dev/null +++ b/script/linux_build.sh @@ -0,0 +1,21 @@ +# 1. clone MNN +git clone https://github.com/alibaba/MNN.git -b 2.6.3 --depth=1 + +# 2. build MNN +cd MNN +mkdir build +cd build +cmake -DMNN_LOW_MEMORY=ON .. +make -j8 +cd ../.. + +# 3. copy headers and libs +cp -r MNN/include/MNN include +mv MNN/build/libMNN.so MNN/build/express/libMNN_Express.so libs + +# 4. build mnn-llm +mkdir build +cd build +cmake .. +make -j8 +cd .. \ No newline at end of file