File tree Expand file tree Collapse file tree 5 files changed +6
-7
lines changed
packages/react-native-executorch/common/rnexecutorch/models Expand file tree Collapse file tree 5 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -36,13 +36,13 @@ TokenIdsWithAttentionMask TextEmbeddings::preprocess(const std::string &input) {
3636}
3737
3838void TextEmbeddings::unload () noexcept {
39- std::scoped_lock lock (generate_mutex_ );
39+ std::scoped_lock lock (inference_mutex_ );
4040 BaseModel::unload ();
4141}
4242
4343std::shared_ptr<OwningArrayBuffer>
4444TextEmbeddings::generate (const std::string input) {
45- std::scoped_lock lock (generate_mutex_ );
45+ std::scoped_lock lock (inference_mutex_ );
4646 auto preprocessed = preprocess (input);
4747
4848 std::vector<int32_t > tokenIdsShape = {
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ class TextEmbeddings final : public BaseEmbeddings {
2424 void unload () noexcept ;
2525
2626private:
27- mutable std::mutex generate_mutex_ ;
27+ mutable std::mutex inference_mutex_ ;
2828 std::vector<std::vector<int32_t >> inputShapes;
2929 TokenIdsWithAttentionMask preprocess (const std::string &input);
3030 std::unique_ptr<TokenizerModule> tokenizer;
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ std::shared_ptr<OwningArrayBuffer>
5858TextToImage::generate (std::string input, int32_t imageSize,
5959 size_t numInferenceSteps, int32_t seed,
6060 std::shared_ptr<jsi::Function> callback) {
61- std::scoped_lock lock (generate_mutex_ );
61+ std::scoped_lock lock (inference_mutex_ );
6262 setImageSize (imageSize);
6363 setSeed (seed);
6464
@@ -138,7 +138,7 @@ size_t TextToImage::getMemoryLowerBound() const noexcept {
138138}
139139
140140void TextToImage::unload () noexcept {
141- std::scoped_lock lock (generate_mutex_ );
141+ std::scoped_lock lock (inference_mutex_ );
142142 encoder->unload ();
143143 unet->unload ();
144144 decoder->unload ();
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ class TextToImage final {
5050 static constexpr float guidanceScale = 7 .5f ;
5151 static constexpr float latentsScale = 0 .18215f ;
5252 bool interrupted = false ;
53- mutable std::mutex generate_mutex_ ;
53+ mutable std::mutex inference_mutex_ ;
5454
5555 std::shared_ptr<react::CallInvoker> callInvoker;
5656 std::unique_ptr<Scheduler> scheduler;
Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ class VoiceActivityDetection : public BaseModel {
2929
3030private:
3131 mutable std::mutex inference_mutex_;
32-
3332 std::vector<std::array<float , constants::kPaddedWindowSize >>
3433 preprocess (std::span<float > waveform) const ;
3534 std::vector<types::Segment> postprocess (const std::vector<float > &scores,
You can’t perform that action at this time.
0 commit comments