Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 88 additions & 23 deletions .github/workflows/integration-test-qvac-lib-infer-whispercpp.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Integration Tests (Whispercpp)
name: Run Integration Tests
Comment thread
freddy311082 marked this conversation as resolved.

on:
workflow_dispatch:
Expand All @@ -10,7 +10,7 @@ on:
workflow_call:
inputs:
ref:
description: "ref"
description: 'ref'
type: string
repository:
type: string
Expand All @@ -21,19 +21,16 @@ jobs:
continue-on-error: true
runs-on: ${{ matrix.os }}
name: ${{ matrix.platform }}-${{ matrix.arch }}-integration-tests

env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
WORKDIR: packages/qvac-lib-infer-whispercpp

permissions:
contents: read
packages: read

Comment thread
freddy311082 marked this conversation as resolved.
strategy:
fail-fast: false
matrix:
include:
# Run Linux x64 tests on both Ubuntu 22.04 and 24.04 to ensure compatibility
- os: ubuntu-22.04
platform: linux
arch: x64
Expand All @@ -46,7 +43,7 @@ jobs:
- os: macos-14-xlarge
platform: darwin
arch: arm64
- os: windows-2022
- os: ai-run-windows-gpu
platform: win32
arch: x64

Expand All @@ -68,8 +65,8 @@ jobs:
repository: ${{ inputs.repository || github.repository }}
token: ${{ secrets.PAT_TOKEN }}

- name: Configure scoped registry for @tetherto and @qvac packages
working-directory: ${{ env.WORKDIR }}
- name: Configure scoped registry for @tetherto and @qvac packages (Unix)
if: ${{ matrix.platform != 'win32' }}
env:
GPR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -80,6 +77,7 @@ jobs:
set -eu
echo "Writing .npmrc for dual registry install…"
cat > .npmrc <<NPMRC
always-auth=true
registry=https://registry.npmjs.org/
@qvac:registry=https://registry.npmjs.org/
@tetherto:registry=https://npm.pkg.github.com/
Expand All @@ -95,29 +93,82 @@ jobs:
git config --global url."https://${{ github.token }}:@github.com/".insteadOf "https://github.com/"
fi

- name: Configure scoped registry for @tetherto and @qvac packages (Windows)
if: ${{ matrix.platform == 'win32' }}
env:
GPR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_PAT: ${{ secrets.PAT_TOKEN }}
shell: powershell
run: |
Write-Host "Configuring scoped registry for @tetherto and @qvac packages..."
$npmrc = @"
always-auth=true
registry=https://registry.npmjs.org/
@qvac:registry=https://registry.npmjs.org/
@tetherto:registry=https://npm.pkg.github.com/
//registry.npmjs.org/:_authToken=$env:NPM_TOKEN
//npm.pkg.github.com/:_authToken=$env:GPR_TOKEN
"@
$npmrc | Out-File -FilePath .npmrc -Encoding utf8
if ($env:GIT_PAT) {
git config --global url."https://$($env:GIT_PAT):@github.com/".insteadOf "https://github.com/"
} else {
git config --global url."https://${{ github.token }}:@github.com/".insteadOf "https://github.com/"
}

- name: Install NPM dependencies
working-directory: ${{ env.WORKDIR }}
shell: bash
run: |
npm install
npm install -g bare bare-make
npm install -g bare@1.26.0 bare-make

- name: Download prebuilds from artifact
if: ${{ !inputs.prebuild_package }}
uses: actions/download-artifact@v4
with:
path: ${{ env.WORKDIR }}/prebuilds
path: prebuilds
merge-multiple: true

- name: Download prebuilds from package
if: ${{ inputs.prebuild_package }}
working-directory: ${{ env.WORKDIR }}
- name: Download prebuilds from package (Unix)
if: ${{ inputs.prebuild_package && matrix.platform != 'win32' }}
shell: bash
run: |
mkdir -p prebuilds
npm pack "${{ inputs.prebuild_package }}" --pack-destination /tmp
npm pack ${{ inputs.prebuild_package }} --pack-destination /tmp
tar -xzf /tmp/*.tgz -C /tmp
cp -r /tmp/package/prebuilds/* prebuilds/
find prebuilds -type f -name 'tetherto__*' | while read f; do
mv "$f" "${f/tetherto__/qvac__}"
done

- name: Download prebuilds from package (Windows)
if: ${{ inputs.prebuild_package && matrix.platform == 'win32' }}
shell: powershell
run: |
New-Item -ItemType Directory -Force -Path prebuilds | Out-Null
npm pack ${{ inputs.prebuild_package }} --pack-destination $env:TEMP
$tgz = Get-ChildItem "$env:TEMP\*.tgz" | Select-Object -First 1
tar -xzf $tgz.FullName -C $env:TEMP
Copy-Item -Path "$env:TEMP\package\prebuilds\*" -Destination prebuilds -Recurse -Force
Get-ChildItem -Path prebuilds -Recurse -File -Filter 'tetherto__*' | ForEach-Object {
$newName = $_.Name -replace 'tetherto__', 'qvac__'
Rename-Item -Path $_.FullName -NewName $newName
}

- name: Install gh cli for ai-run-linux-gpu
if: matrix.os == 'ai-run-linux-gpu'
shell: bash
run: |
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
&& cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
gh --version
continue-on-error: true

- name: Install gh cli for ai-run-linux-gpu
if: matrix.os == 'ai-run-linux-gpu'
Expand Down Expand Up @@ -155,18 +206,32 @@ jobs:
run: |
brew install --quiet openblas lapack fftw

- name: Run integration test
working-directory: ${{ env.WORKDIR }}
- name: Run integration test (Unix)
if: ${{ matrix.platform != 'win32' }}
shell: bash
run: |
npm run test:integration
run: npm run test:integration
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}

- name: Run integration test (Windows)
if: ${{ matrix.platform == 'win32' }}
shell: powershell
run: npm run test:integration
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}

- name: Print run state
working-directory: ${{ env.WORKDIR }}
- name: Print run state (Unix)
if: ${{ matrix.platform != 'win32' }}
shell: bash
run: |
ls -la prebuilds || true
tree prebuilds || true
continue-on-error: true

- name: Print run state (Windows)
if: ${{ matrix.platform == 'win32' }}
shell: powershell
run: |
Get-ChildItem prebuilds -ErrorAction SilentlyContinue
tree prebuilds /F 2>$null
continue-on-error: true
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,6 @@ void WhisperModel::load() {
throw std::runtime_error("Failed to initialize Whisper context");
}

state_.reset(whisper_init_state(ctx_.get()));
if (state_ == nullptr) {
QLOG(
qvac_lib_inference_addon_cpp::logger::Priority::ERROR,
"Failed to initialize Whisper state");
throw std::runtime_error("Failed to initialize Whisper state");
}
Comment thread
freddy311082 marked this conversation as resolved.
is_loaded_ = true;
QLOG(
qvac_lib_inference_addon_cpp::logger::Priority::INFO,
Expand Down Expand Up @@ -238,9 +231,8 @@ void WhisperModel::warmup() {
params.new_segment_callback_user_data = nullptr;

// Run warmup inference to "heat up" the model
whisper_full_with_state(
whisper_full(
ctx_.get(),
state_.get(),
params,
silentAudio.data(),
static_cast<int>(silentAudio.size()));
Expand Down Expand Up @@ -282,9 +274,8 @@ void WhisperModel::process(const Input& input) {
params.new_segment_callback = onNewSegment;
params.new_segment_callback_user_data = &ud;

int result = whisper_full_with_state(
int result = whisper_full(
ctx_.get(),
state_.get(),
params,
input.data(),
static_cast<int>(input.size()));
Expand Down Expand Up @@ -373,7 +364,6 @@ bool WhisperModel::configContextIsChanged(

void WhisperModel::resetContext() {
ctx_.reset();
state_.reset();
}

void WhisperModel::setConfig(const WhisperConfig& config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,7 @@ class WhisperModel {
}
};

struct WhisperStateDeleter {
void operator()(whisper_state* state) const noexcept {
if (state != nullptr) {
whisper_free_state(state);
}
}
};

std::unique_ptr<whisper_context, WhisperContextDeleter> ctx_{nullptr};
std::unique_ptr<whisper_state, WhisperStateDeleter> state_{nullptr};
Comment thread
freddy311082 marked this conversation as resolved.
bool stream_ended_ = false;
bool is_loaded_ = false;
bool is_warmed_up_ = false;
Expand Down
2 changes: 1 addition & 1 deletion packages/qvac-lib-infer-whispercpp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@qvac/transcription-whispercpp",
"version": "0.3.17",
"version": "0.3.18",
"description": "transcription addon for qvac",
"addon": true,
"engines": {
Expand Down
25 changes: 25 additions & 0 deletions packages/qvac-lib-infer-whispercpp/release-notes/v0.3.18.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# QVAC Transcription Whisper Addon v0.3.18 Release Notes

This release updates the whisper.cpp integration to use the latest API and improves Windows platform support for CI/CD workflows.

## Features

### Enhanced Windows Platform Support

The integration test workflow now includes comprehensive Windows support with PowerShell-specific configurations. This includes separate registry configuration steps for Unix and Windows platforms, ensuring proper package authentication across all environments. The workflow now uses the `ai-run-windows-gpu` runner for better GPU-accelerated testing on Windows.

### Prebuild Package Renaming Support

Added automatic renaming of prebuild packages from `tetherto__*` to `qvac__*` format during the package download process. This ensures consistency across all platforms and simplifies the build artifact management.

## Bug Fixes

### Whisper.cpp API Compatibility

Updated the integration with whisper.cpp to use the new 4-parameter API for `whisper_full()`. The previous 5-parameter version that included an explicit state parameter has been deprecated. The state is now managed internally by the whisper.cpp context, simplifying the code and removing unnecessary state management overhead.

Removed the obsolete `whisper_state` member variable and related initialization code, as the new whisper.cpp API handles state management automatically through the context object.

## Other

Updated the integration test workflow to use a specific version of `bare@1.26.0` for better build consistency. Added the `always-auth=true` configuration for npm registry authentication to improve reliability when downloading private packages.
Loading