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 22, 2024
1 parent 238ba0b commit 55aaf15
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 31 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
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 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 55aaf15

Please sign in to comment.