From 91ca2ce9bcfbdc6d69e378d09ea7e278c9ef0abb Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Mon, 4 Mar 2024 08:16:03 -0800 Subject: [PATCH] CI: Abstract the steps to prepare the LLM --- .github/actions/prepare-llm/action.yml | 19 +++++++++++++++++++ .github/workflows/test-babashka.yml | 12 +++--------- .github/workflows/test-bun.yml | 12 +++--------- .github/workflows/test-cpython.yml | 12 +++--------- .github/workflows/test-nodejs.yml | 12 +++--------- .github/workflows/test-pypy.yml | 12 +++--------- 6 files changed, 34 insertions(+), 45 deletions(-) create mode 100644 .github/actions/prepare-llm/action.yml diff --git a/.github/actions/prepare-llm/action.yml b/.github/actions/prepare-llm/action.yml new file mode 100644 index 0000000..1572c15 --- /dev/null +++ b/.github/actions/prepare-llm/action.yml @@ -0,0 +1,19 @@ +name: Prepare llama.cpp and Phi 2 +description: Build llama.cpp and load Phi 2 +runs: + using: "composite" + steps: + - name: Get and build llama.cpp + shell: bash + run: | + git clone https://github.com/ggerganov/llama.cpp.git + cd llama.cpp + make server + + - name: Download Phi 2 model + shell: bash + run: curl -OL https://huggingface.co/TheBloke/dolphin-2_6-phi-2-GGUF/resolve/main/dolphin-2_6-phi-2.Q3_K_M.gguf + + - name: Run llama.cpp with Phi 2 + shell: bash + run: ./llama.cpp/server --host 0.0.0.0 -m ./dolphin-2_6-phi-2.Q3_K_M.gguf & diff --git a/.github/workflows/test-babashka.yml b/.github/workflows/test-babashka.yml index a83d74b..755b8f6 100644 --- a/.github/workflows/test-babashka.yml +++ b/.github/workflows/test-babashka.yml @@ -13,16 +13,10 @@ jobs: - run: bb --version - - name: Get and build llama.cpp - run: git clone https://github.com/ggerganov/llama.cpp.git && cd llama.cpp && make + - name: Prepare LLM (Phi 2) + uses: ./.github/actions/prepare-llm - - name: Download Phi 2 model - run: curl -OL https://huggingface.co/TheBloke/dolphin-2_6-phi-2-GGUF/resolve/main/dolphin-2_6-phi-2.Q3_K_M.gguf - - - name: Run llama.cpp with Phi 2 - run: ./llama.cpp/server --host 0.0.0.0 -m ./dolphin-2_6-phi-2.Q3_K_M.gguf & - - - name: Wait until the API server is ready + - name: Wait until the LLM server is ready run: while ! curl -s 'http://localhost:8080/health' | grep 'ok'; do sleep 1; done timeout-minutes: 3 diff --git a/.github/workflows/test-bun.yml b/.github/workflows/test-bun.yml index 3721e6c..0e59523 100644 --- a/.github/workflows/test-bun.yml +++ b/.github/workflows/test-bun.yml @@ -14,16 +14,10 @@ jobs: - run: bun --version - - name: Get and build llama.cpp - run: git clone https://github.com/ggerganov/llama.cpp.git && cd llama.cpp && make + - name: Prepare LLM (Phi 2) + uses: ./.github/actions/prepare-llm - - name: Download Phi 2 model - run: curl -OL https://huggingface.co/TheBloke/dolphin-2_6-phi-2-GGUF/resolve/main/dolphin-2_6-phi-2.Q3_K_M.gguf - - - name: Run llama.cpp with Phi 2 - run: ./llama.cpp/server --host 0.0.0.0 -m ./dolphin-2_6-phi-2.Q3_K_M.gguf & - - - name: Wait until the API server is ready + - name: Wait until the LLM server is ready run: while ! curl -s 'http://localhost:8080/health' | grep 'ok'; do sleep 1; done timeout-minutes: 3 diff --git a/.github/workflows/test-cpython.yml b/.github/workflows/test-cpython.yml index fcba9ff..acaa32b 100644 --- a/.github/workflows/test-cpython.yml +++ b/.github/workflows/test-cpython.yml @@ -13,16 +13,10 @@ jobs: with: python-version: '3.10' - - name: Get and build llama.cpp - run: git clone https://github.com/ggerganov/llama.cpp.git && cd llama.cpp && make + - name: Prepare LLM (Phi 2) + uses: ./.github/actions/prepare-llm - - name: Download Phi 2 model - run: curl -OL https://huggingface.co/TheBloke/dolphin-2_6-phi-2-GGUF/resolve/main/dolphin-2_6-phi-2.Q3_K_M.gguf - - - name: Run llama.cpp with Phi 2 - run: ./llama.cpp/server --host 0.0.0.0 -m ./dolphin-2_6-phi-2.Q3_K_M.gguf & - - - name: Wait until the API server is ready + - name: Wait until the LLM server is ready run: while ! curl -s 'http://localhost:8080/health' | grep 'ok'; do sleep 1; done timeout-minutes: 3 diff --git a/.github/workflows/test-nodejs.yml b/.github/workflows/test-nodejs.yml index 8c77d8b..1ea43a2 100644 --- a/.github/workflows/test-nodejs.yml +++ b/.github/workflows/test-nodejs.yml @@ -13,16 +13,10 @@ jobs: with: node-version: '18' - - name: Get and build llama.cpp - run: git clone https://github.com/ggerganov/llama.cpp.git && cd llama.cpp && make + - name: Prepare LLM (Phi 2) + uses: ./.github/actions/prepare-llm - - name: Download Phi 2 model - run: curl -OL https://huggingface.co/TheBloke/dolphin-2_6-phi-2-GGUF/resolve/main/dolphin-2_6-phi-2.Q3_K_M.gguf - - - name: Run llama.cpp with Phi 2 - run: ./llama.cpp/server --host 0.0.0.0 -m ./dolphin-2_6-phi-2.Q3_K_M.gguf & - - - name: Wait until the API server is ready + - name: Wait until the LLM server is ready run: while ! curl -s 'http://localhost:8080/health' | grep 'ok'; do sleep 1; done timeout-minutes: 3 diff --git a/.github/workflows/test-pypy.yml b/.github/workflows/test-pypy.yml index 1b2aa75..baccf04 100644 --- a/.github/workflows/test-pypy.yml +++ b/.github/workflows/test-pypy.yml @@ -15,16 +15,10 @@ jobs: - run: pypy3 --version - - name: Get and build llama.cpp - run: git clone https://github.com/ggerganov/llama.cpp.git && cd llama.cpp && make + - name: Prepare LLM (Phi 2) + uses: ./.github/actions/prepare-llm - - name: Download Phi 2 model - run: curl -OL https://huggingface.co/TheBloke/dolphin-2_6-phi-2-GGUF/resolve/main/dolphin-2_6-phi-2.Q3_K_M.gguf - - - name: Run llama.cpp with Phi 2 - run: ./llama.cpp/server --host 0.0.0.0 -m ./dolphin-2_6-phi-2.Q3_K_M.gguf & - - - name: Wait until the API server is ready + - name: Wait until the LLM server is ready run: while ! curl -s 'http://localhost:8080/health' | grep 'ok'; do sleep 1; done timeout-minutes: 3