Skip to content

Commit 5bfed1c

Browse files
committed
Fix Phonemis linking in T2S tests
1 parent abed63e commit 5bfed1c

File tree

4 files changed

+21
-15
lines changed

4 files changed

+21
-15
lines changed

packages/react-native-executorch/common/rnexecutorch/tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ add_rn_test(TextToSpeechTests integration/TextToSpeechTest.cpp
231231
${RNEXECUTORCH_DIR}/models/text_to_speech/kokoro/Synthesizer.cpp
232232
${RNEXECUTORCH_DIR}/models/text_to_speech/kokoro/Partitioner.cpp
233233
${RNEXECUTORCH_DIR}/models/text_to_speech/kokoro/Utils.cpp
234-
LIBS ${PHONEMIS_LIBS}
234+
LIBS phonemis
235235
)
236236

237237
add_rn_test(LLMTests integration/LLMTest.cpp

packages/react-native-executorch/common/rnexecutorch/tests/integration/TextToSpeechTest.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "utils/TestUtils.h"
33
#include <algorithm>
44
#include <gtest/gtest.h>
5-
#include <ranges>
65
#include <rnexecutorch/Error.h>
76
#include <rnexecutorch/models/text_to_speech/kokoro/Kokoro.h>
87

packages/react-native-executorch/common/rnexecutorch/tests/run_tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ TEST_EXECUTABLES=(
2929
"VADTests"
3030
"TokenizerModuleTests"
3131
"SpeechToTextTests"
32+
"TextToSpeechTests"
3233
"LLMTests"
3334
"ImageSegmentationTests"
3435
"TextToImageTests"

packages/react-native-executorch/src/hooks/natural_language_processing/useTextToSpeech.ts

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export const useTextToSpeech = ({
9494
const instance = guardReady('forward');
9595
try {
9696
setIsGenerating(true);
97-
return await instance.forward(input.text ?? "", input.speed ?? 1.0);
97+
return await instance.forward(input.text ?? '', input.speed ?? 1.0);
9898
} finally {
9999
setIsGenerating(false);
100100
}
@@ -105,7 +105,7 @@ export const useTextToSpeech = ({
105105
try {
106106
setIsGenerating(true);
107107
return await instance.forwardFromPhonemes(
108-
input.phonemes ?? "",
108+
input.phonemes ?? '',
109109
input.speed ?? 1.0
110110
);
111111
} finally {
@@ -136,7 +136,7 @@ export const useTextToSpeech = ({
136136
setIsGenerating(false);
137137
}
138138
},
139-
[moduleInstance, guardReady]
139+
[guardReady]
140140
);
141141

142142
const streamFromPhonemes = useCallback(
@@ -161,17 +161,23 @@ export const useTextToSpeech = ({
161161
[guardReady]
162162
);
163163

164-
const streamInsert = useCallback((text: string) => {
165-
if (moduleInstance) {
166-
moduleInstance.streamInsert(text);
167-
}
168-
}, [moduleInstance]);
164+
const streamInsert = useCallback(
165+
(text: string) => {
166+
if (moduleInstance) {
167+
moduleInstance.streamInsert(text);
168+
}
169+
},
170+
[moduleInstance]
171+
);
169172

170-
const streamStop = useCallback((instant: boolean = true) => {
171-
if (moduleInstance) {
172-
moduleInstance.streamStop(instant);
173-
}
174-
}, [moduleInstance]);
173+
const streamStop = useCallback(
174+
(instant: boolean = true) => {
175+
if (moduleInstance) {
176+
moduleInstance.streamStop(instant);
177+
}
178+
},
179+
[moduleInstance]
180+
);
175181

176182
return {
177183
error,

0 commit comments

Comments
 (0)