Skip to content

Commit

Permalink
build(ci/nitro-node): add mising glibc dependency on Ubuntu runners
Browse files Browse the repository at this point in the history
  • Loading branch information
InNoobWeTrust committed Feb 23, 2024
1 parent 238ba0b commit 28acd27
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 37 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/build-nitro-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
workflow_dispatch:

env:
LLM_MODEL_URL: https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v0.3-GGUF/resolve/main/tinyllama-1.1b-chat-v0.3.Q2_K.gguf
LLM_MODEL_URL: https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf
WHISPER_MODEL_URL: https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny-q5_1.bin

jobs:
Expand All @@ -23,13 +23,9 @@ jobs:
strategy:
matrix:
os:
- ubuntu-18-04-cuda-12-0
- ubuntu-18-04-cuda-11-7
- macos-silicon
- ubuntu-latest
- macos-latest
- windows-latest
- windows-cuda-12-0
- windows-cuda-11-7

steps:
- name: Clone
Expand All @@ -54,7 +50,7 @@ jobs:
id: download-model-file
name: Download model file
with:
url: ${{ env.LLM_MODEL_URL }}
url: "The model we are using is [tinyllama-1.1b](${{ env.LLM_MODEL_URL }})!"
target: nitro-node/test/test_assets/
auto-match: true
retry-times: 3
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
"!docs/**",
"!.gitignore",
"!README.md",
"!nitro-node",
"!nitro-node/**",
]
pull_request:
types: [opened, synchronize, reopened]
Expand All @@ -45,7 +45,7 @@ on:
"!docs/**",
"!.gitignore",
"!README.md",
"!nitro-node",
"!nitro-node/**",
]
workflow_dispatch:

Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
}
# Get the latest release tag from GitHub API
LATEST_TAG=$(get_latest_tag)
# Remove the 'v' and append the build number to the version
NEW_VERSION="${LATEST_TAG#v}-${GITHUB_RUN_NUMBER}"
echo "New version: $NEW_VERSION"
Expand Down Expand Up @@ -347,7 +347,7 @@ jobs:
run: |
./install_deps.sh
mkdir build && cd build
cmake -DWHISPER_COREML=1 -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} ..
cmake -DWHISPER_COREML=1 -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} ..
CC=gcc-8 make -j $(sysctl -n hw.ncpu)
ls -la
Expand Down Expand Up @@ -425,7 +425,7 @@ jobs:
run: |
./install_deps.sh
mkdir build && cd build
cmake -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} -DLLAMA_METAL=OFF ..
cmake -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} -DLLAMA_METAL=OFF ..
CC=gcc-8 make -j $(sysctl -n hw.ncp)
ls -la
Expand Down Expand Up @@ -501,7 +501,7 @@ jobs:
run: |
./install_deps.sh
mkdir build && cd build
cmake -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} -DLLAMA_VULKAN=OFF -DLLAMA_METAL=OFF ..
cmake -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} -DLLAMA_VULKAN=OFF -DLLAMA_METAL=OFF ..
CC=gcc-8 make -j $(sysctl -n hw.ncp)
ls -la
Expand Down
22 changes: 11 additions & 11 deletions nitro-node/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,33 @@

all: publish

# Installs yarn dependencies
# Installs npm dependencies
#install: build-core
install:
ifeq ($(OS),Windows_NT)
yarn config set network-timeout 300000
npm config set fetch-timeout 300000
endif
yarn install
npm install

# Build
build: install
yarn run build
npm run build

# Download Nitro
download-nitro: install
yarn run downloadnitro
npm run downloadnitro

test-ci: install
yarn test
npm test

# Note, this make target is just for testing on *NIX systems
test: install
@test -e test/test_assets/*.gguf && echo "test/test_assets/*.gguf is already downloaded" || (mkdir -p test/test_assets && cd test/test_assets/ && curl -JLO "https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf")
yarn test
npm test

# Builds and pack
pack: build
yarn run build:publish
npm run build:publish

# Test that installation will also download nitro binaries
test-e2e-installation: pack
Expand All @@ -43,9 +43,9 @@ endif

clean:
ifeq ($(OS),Windows_NT)
powershell -Command "Remove-Item -Recurse -Force -Path *.tgz, .yarn, yarn.lock, package-lock.json, bin, dist"
powershell -Command "Get-ChildItem -Path . -Include node_modules -Recurse -Directory | Remove-Item -Recurse -Force"
powershell -Command "Get-ChildItem -Path . -Include *.tgz, package-lock.json -Recurse | Remove-Item -Recurse -Force"
powershell -Command "Get-ChildItem -Path . -Include node_modules, bin, dist -Recurse -Directory | Remove-Item -Recurse -Force"
else
rm -rf *.tgz .yarn yarn.lock package-lock.json bin dist
rm -rf *.tgz package-lock.json bin dist
find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
endif
22 changes: 9 additions & 13 deletions nitro-node/test/nitro-process.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ describe("Manage nitro process", () => {
await validateModelStatus();
// Arrays of all the chunked response
let streamedContent: Record<string, any>[] = [];
let chunkCounter = 0;
// Run chat completion with stream
const response = await chatCompletion(
{
Expand All @@ -204,18 +203,15 @@ describe("Manage nitro process", () => {
},
new WritableStream({
write(chunk: string) {
const data = chunk.replace(/^\s*data:\s*/, "").trim();
// Stop at [DONE] message
if (data.match(/\[DONE\]/)) {
return;
}
chunkCounter++;
try {
const parts = chunk.split('\n').filter(p => Boolean(p.trim().length))
for (const part of parts) {
const data = part.replace(/^\s*data:\s*/, "").trim();
// Stop at [DONE] message
if (data.match(/\[DONE\]/)) {
return;
}
// Parse the streamed content
streamedContent.push(JSON.parse(data));
} catch (e) {
// Skip invalid json data
console.error(e, data);
}
},
//close() {},
Expand All @@ -235,8 +231,8 @@ describe("Manage nitro process", () => {
await expect(response.json).rejects.toThrow();
// Response body should be used already
expect(response.bodyUsed).toBeTruthy();
// There should be no invalid chunk of json data
expect(streamedContent.length).toEqual(chunkCounter);
// There should be multiple chunks of json data
expect(streamedContent.length).toBeGreaterThan(0);
// Stop nitro
await stopModel();
},
Expand Down

0 comments on commit 28acd27

Please sign in to comment.