Skip to content

Commit b570fcb

Browse files
committed
Remove unused variables and ET_EXPERIMENTAL from runner
1 parent 4217fd3 commit b570fcb

File tree

13 files changed

+18
-24
lines changed

13 files changed

+18
-24
lines changed

packages/react-native-executorch/android/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@ set(COMMON_CPP_DIR "${CMAKE_SOURCE_DIR}/../common")
1414
set(LIBS_DIR "${CMAKE_SOURCE_DIR}/../third-party/android/libs")
1515
set(INCLUDE_DIR "${CMAKE_SOURCE_DIR}/../third-party/include")
1616

17+
# Treat third-party headers as system headers to suppress deprecation warnings
18+
include_directories(SYSTEM "${INCLUDE_DIR}")
19+
1720
add_subdirectory("${ANDROID_CPP_DIR}")

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ using namespace facebook;
88

99
TokenizerModule::TokenizerModule(
1010
std::string source, std::shared_ptr<react::CallInvoker> callInvoker)
11-
: memorySizeLowerBound(std::filesystem::file_size(source)),
12-
tokenizer(tokenizers::Tokenizer::FromBlobJSON(
13-
file_utils::loadBytesFromFile(source))) {}
11+
: tokenizer(tokenizers::Tokenizer::FromBlobJSON(
12+
file_utils::loadBytesFromFile(source))),
13+
memorySizeLowerBound(std::filesystem::file_size(source)) {}
1414

1515
void TokenizerModule::ensureTokenizerLoaded(
1616
const std::string &methodName) const {

packages/react-native-executorch/common/rnexecutorch/models/text_to_image/Scheduler.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class Scheduler final {
3030
std::vector<float> tempFirstSample;
3131
std::vector<std::vector<float>> ets;
3232
float finalAlphaCumprod{1.0f};
33-
float initNoiseSigma{1.0f};
3433

3534
size_t numInferenceSteps{0};
3635

packages/react-native-executorch/common/rnexecutorch/models/text_to_image/TextToImage.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ TextToImage::generate(std::string input, int32_t imageSize,
6262
auto embeddingsTensor =
6363
make_tensor_ptr(embeddingsShape, embeddings.data(), ScalarType::Float);
6464

65-
constexpr int32_t latentDownsample = 8;
6665
int32_t latentsSize = numChannels * latentImageSize * latentImageSize;
6766
std::vector<float> latents(latentsSize);
6867
std::mt19937 gen(seed);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace executorch {
2121
namespace extension {
2222
namespace llm {
2323

24-
class ET_EXPERIMENTAL IRunner {
24+
class IRunner {
2525
public:
2626
virtual ~IRunner() = default;
2727

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ std::string loadBytesFromFile(const std::string &path) {
3939

4040
namespace {
4141
static constexpr auto kEnableDynamicShape = "enable_dynamic_shape";
42-
static constexpr auto kBosId = "get_bos_id";
4342
static constexpr auto kEosIds = "get_eos_ids";
4443
static constexpr auto kMaxSeqLen = "get_max_seq_len";
4544
static constexpr auto kMaxContextLen = "get_max_context_len";
@@ -175,10 +174,7 @@ Error Runner::generate(const std::string &prompt,
175174
stats_.inference_start_ms = llm::time_in_ms();
176175
shouldStop_ = false;
177176

178-
// Set the sequence length to the max seq length if not provided
179-
int32_t seq_len = (seq_len > 0 && seq_len <= metadata_.at(kMaxSeqLen))
180-
? seq_len
181-
: metadata_.at(kMaxSeqLen);
177+
int32_t seq_len = metadata_.at(kMaxSeqLen);
182178

183179
std::vector<int32_t> prompt_tokens = tokenizer_->Encode(prompt);
184180
std::vector<uint64_t> prompt_tokens_uint64(prompt_tokens.begin(),

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

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

2828
namespace example {
2929

30-
class ET_EXPERIMENTAL Runner : public executorch::extension::llm::IRunner {
30+
class Runner : public executorch::extension::llm::IRunner {
3131
public:
3232
explicit Runner(const std::string &model_path,
3333
const std::string &tokenizer_path,

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

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

29-
template <typename T> struct ET_EXPERIMENTAL ProbIndex {
29+
template <typename T> struct ProbIndex {
3030
T prob;
3131
int32_t index;
3232
}; // struct used when sorting probabilities during top-p sampling
3333

34-
class ET_EXPERIMENTAL Sampler {
34+
class Sampler {
3535
public:
3636
Sampler(int32_t vocab_size, float temperature, float topp,
3737
unsigned long long rng_seed);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace executorch {
1818
namespace extension {
1919
namespace llm {
2020

21-
struct ET_EXPERIMENTAL Stats {
21+
struct Stats {
2222
// Scaling factor for timestamps - in this case, we use ms.
2323
const long SCALING_FACTOR_UNITS_PER_SECOND = 1000;
2424
// Time stamps for the different stages of the execution

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace executorch {
2020
namespace extension {
2121
namespace llm {
2222

23-
class ET_EXPERIMENTAL TextDecoderRunner {
23+
class TextDecoderRunner {
2424
public:
2525
TextDecoderRunner(Module *module, bool use_kv_cache, int32_t vocab_size,
2626
float temperature);

0 commit comments

Comments
 (0)