Skip to content

Commit e65ea32

Browse files
committed
test: force to HTP0
1 parent 97704fc commit e65ea32

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/WhisperContext.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ class WhisperVadWorker : public Napi::AsyncWorker {
271271

272272
// Lock the session to ensure thread safety
273273
std::lock_guard<std::mutex> lock(session_->mtx);
274-
274+
275275
if (!session_->ctx) {
276276
SetError("VAD context was destroyed");
277277
return;
@@ -283,7 +283,7 @@ class WhisperVadWorker : public Napi::AsyncWorker {
283283
// Calculate speech probability from VAD probabilities
284284
int n_probs = whisper_vad_n_probs(session_->ctx);
285285
float* probs = whisper_vad_probs(session_->ctx);
286-
286+
287287
if (n_probs > 0 && probs) {
288288
// Calculate average probability across all frames
289289
float prob_sum = 0.0f;
@@ -300,17 +300,17 @@ class WhisperVadWorker : public Napi::AsyncWorker {
300300
// Get VAD segments using provided parameters
301301
whisper_vad_segments* segments = whisper_vad_segments_from_samples(
302302
session_->ctx, vadParams_, audioData_.data(), audioData_.size());
303-
303+
304304
if (segments) {
305305
int n_segments = whisper_vad_segments_n_segments(segments);
306-
306+
307307
for (int i = 0; i < n_segments; i++) {
308308
float t0 = whisper_vad_segments_get_segment_t0(segments, i);
309309
float t1 = whisper_vad_segments_get_segment_t1(segments, i);
310-
310+
311311
segments_.push_back({t0, t1});
312312
}
313-
313+
314314
whisper_vad_free_segments(segments);
315315
}
316316
}
@@ -319,15 +319,15 @@ class WhisperVadWorker : public Napi::AsyncWorker {
319319
void OnOK() override {
320320
Napi::Env env = Env();
321321
Napi::Array result = Napi::Array::New(env);
322-
322+
323323
// Create VadSegment[] - array of objects with t0 and t1 properties
324324
for (size_t i = 0; i < segments_.size(); i++) {
325325
Napi::Object segment = Napi::Object::New(env);
326326
segment.Set("t0", segments_[i].first);
327327
segment.Set("t1", segments_[i].second);
328328
result.Set(i, segment);
329329
}
330-
330+
331331
Callback().Call({Env().Null(), result});
332332
}
333333

@@ -442,7 +442,7 @@ void WhisperContext::ToggleNativeLog(const Napi::CallbackInfo& info) {
442442
if (info.Length() < 1) return;
443443

444444
bool enable = whisper_utils::getBool(info[0], false);
445-
445+
446446
if (enable) {
447447
// If enabling logging and a callback is provided, set it up
448448
if (info.Length() >= 2 && info[1].IsFunction()) {
@@ -725,22 +725,22 @@ Napi::Value WhisperContext::TranscribeData(const Napi::CallbackInfo& info) {
725725

726726
Napi::Value WhisperContext::AbortTranscribe(const Napi::CallbackInfo& info) {
727727
Napi::Env env = info.Env();
728-
728+
729729
if (info.Length() < 1 || !info[0].IsNumber()) {
730730
Napi::TypeError::New(env, "Expected job ID").ThrowAsJavaScriptException();
731731
return env.Null();
732732
}
733-
733+
734734
int jobId = info[0].As<Napi::Number>().Int32Value();
735-
735+
736736
{
737737
std::lock_guard<std::mutex> lock(_cancelMutex);
738738
auto it = _cancelFlags.find(jobId);
739739
if (it != _cancelFlags.end()) {
740740
it->second->store(true);
741741
}
742742
}
743-
743+
744744
auto deferred = Napi::Promise::Deferred::New(env);
745745
deferred.Resolve(env.Undefined());
746746
return deferred.Promise();
@@ -904,7 +904,7 @@ WhisperVadContext::WhisperVadContext(const Napi::CallbackInfo& info) : Napi::Obj
904904
// Initialize VAD context with proper parameters
905905
whisper_vad_context_params vparams = whisper_vad_default_context_params();
906906
vparams.use_gpu = useGpu;
907-
vparams.gpu_device = 0;
907+
vparams.gpu_device = 1; // TEMP: HTP0
908908
vparams.n_threads = nThreads;
909909

910910
whisper_vad_context* ctx = whisper_vad_init_from_file_with_params(modelPath.c_str(), vparams);
@@ -928,7 +928,7 @@ void WhisperVadContext::ToggleNativeLog(const Napi::CallbackInfo& info) {
928928
if (info.Length() < 1) return;
929929

930930
bool enable = whisper_utils::getBool(info[0], false);
931-
931+
932932
if (enable) {
933933
// If enabling logging and a callback is provided, set it up
934934
if (info.Length() >= 2 && info[1].IsFunction()) {

0 commit comments

Comments
 (0)