Skip to content

Commit 1b7363d

Browse files
authored
build: build with executorch 1.1 (#765) (#806)
## Description Bumped ExecuTorch binaries & headers to 1.1.0 version of the package. ### Introduces a breaking change? - [ ] Yes - [x] No ### Type of change - [ ] Bug fix (change which fixes an issue) - [ ] New feature (change which adds functionality) - [ ] Documentation update (improves or adds clarity to existing documentation) - [x] Other (chores, tests, code style improvements etc.) ### Tested on - [x] iOS - [x] Android ### Testing instructions Run all the test from `packages/react-native-executorch/common/rnexecutorch/tests` and verify the correctness of all models (except Speech-to-Text, see the **Additional notes** section). ### Screenshots <!-- Add screenshots here, if applicable --> ### Related issues <!-- Link related issues here using #issue-number --> ### Checklist - [ ] I have performed a self-review of my code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have updated the documentation accordingly - [x] My changes generate no new warnings ### Additional notes I tested most of the models on both Android & iOS platforms. The only 'broken' model seems to be Speech To Text Encoder - but this one will be fixed in the incoming STT fix PR.
1 parent 22a84b7 commit 1b7363d

File tree

287 files changed

+54373
-25259
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

287 files changed

+54373
-25259
lines changed

apps/llm/app/voice_chat/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function VoiceChatScreen() {
101101
return !llm.isReady || !speechToText.isReady ? (
102102
<Spinner
103103
visible={!llm.isReady || !speechToText.isReady}
104-
textContent={`Loading the model ${(llm.downloadProgress * 100).toFixed(0)} %\nLoading the speech model ${(speechToText.downloadProgress * 100).toFixed(0)} %`}
104+
textContent={`Loading the LLM model ${(llm.downloadProgress * 100).toFixed(0)} %\nLoading the speech model ${(speechToText.downloadProgress * 100).toFixed(0)} %`}
105105
/>
106106
) : (
107107
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
1.76 KB
Binary file not shown.

packages/react-native-executorch/common/rnexecutorch/TokenizerModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace rnexecutorch {
1111
using namespace facebook;
12-
using namespace executorch::extension::constants;
12+
using namespace executorch::extension::llm;
1313

1414
TokenizerModule::TokenizerModule(
1515
std::string source, std::shared_ptr<react::CallInvoker> callInvoker)

packages/react-native-executorch/common/rnexecutorch/models/BaseModel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class BaseModel {
4646
// (unnecessary copies instead of working on JS memory). In this case
4747
// CallInvoker can be used to get jsi::Runtime, and use it in a safe manner.
4848
std::shared_ptr<react::CallInvoker> callInvoker;
49-
std::unique_ptr<executorch::extension::Module> module_;
49+
std::unique_ptr<Module> module_;
5050

5151
std::size_t memorySizeLowerBound{0};
5252

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ TEST(S2TTranscribeTests, TranscribeReturnsValidChars) {
7474
auto result = model.transcribe(audio, "en", true);
7575
ASSERT_EQ(result.language, "en");
7676
EXPECT_GE(result.duration, 20.0f);
77-
ASSERT_EQ(result.task, "transcription");
77+
ASSERT_EQ(result.task, "transcribe");
7878
ASSERT_FALSE(result.segments.empty());
7979
ASSERT_FALSE(result.text.empty());
8080
for (char c : result.text) {

packages/react-native-executorch/common/runner/constants.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
#pragma once
99
// constants for LLM runtime
10-
namespace executorch::extension::constants {
10+
namespace executorch::extension::llm {
1111

1212
// Runtime metadata key constants
1313
inline constexpr auto kEnableDynamicShape = "enable_dynamic_shape";
@@ -27,4 +27,5 @@ inline constexpr auto kTextModelMethod = "text_decoder";
2727

2828
inline constexpr auto numOfAddedBoSTokens = 0;
2929
inline constexpr auto numOfAddedEoSTokens = 0;
30-
} // namespace executorch::extension::constants
30+
31+
} // namespace executorch::extension::llm

packages/react-native-executorch/common/runner/irunner.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ struct GenerationConfig {
6565

6666
// Use KV_CACHE implementation (if implemented) or not
6767
bool enable_kv_cache = true;
68+
69+
// Number of eos and bos to add to the prompt
70+
int32_t num_bos = 0;
71+
int32_t num_eos = 0;
6872
};
6973

7074
// Base interface for LLM runners

packages/react-native-executorch/common/runner/kernel_includes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#pragma once
1616

1717
// This list should be very conservative since most kernel .cpp files will
18-
// include these and depend on their transitive deps. Only add a header if 99%
19-
// of kernels would have included it anyway.
18+
// include these and depend on their transitive deps. Only add a header if
19+
// 99% of kernels would have included it anyway.
2020
#include <executorch/runtime/core/exec_aten/exec_aten.h> // IWYU pragma: export
2121
#include <executorch/runtime/core/exec_aten/util/scalar_type_util.h> // IWYU pragma: export
2222
#include <executorch/runtime/core/exec_aten/util/tensor_util.h> // IWYU pragma: export

packages/react-native-executorch/common/runner/runner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
namespace example {
2121

22-
using namespace executorch::extension::constants;
22+
using namespace executorch::extension::llm;
2323
using ::executorch::extension::Module;
2424
using ::executorch::runtime::Error;
2525
using ::executorch::runtime::Result;

packages/react-native-executorch/common/runner/sampler.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ namespace extension {
2626
namespace llm {
2727
// A simple llama2 sampler.
2828

29+
inline constexpr auto kTopp = 0.9f;
30+
2931
template <typename T> struct ProbIndex {
3032
T prob;
3133
int32_t index;
@@ -65,3 +67,9 @@ using ::executorch::extension::llm::ProbIndex;
6567
using ::executorch::extension::llm::Sampler;
6668
} // namespace executor
6769
} // namespace torch
70+
71+
namespace executorch::llm {
72+
// TODO(T197294990): Remove these deprecated aliases once all users have moved
73+
// to the new `::executorch::extension::llm` namespaces.
74+
using ::executorch::extension::llm::kTopp;
75+
} // namespace executorch::llm

0 commit comments

Comments
 (0)