File tree Expand file tree Collapse file tree
packages/react-native-executorch/common/runner Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -342,14 +342,14 @@ void Runner::set_topp(float topp) noexcept {
342342 }
343343}
344344
345- int32_t Runner::get_max_context_length () const {
345+ size_t Runner::get_max_context_length () const {
346346 if (!is_loaded ()) {
347- return static_cast < int32_t >( metadata_.at (kMaxContextLen ) );
347+ return metadata_.at (kMaxContextLen );
348348 }
349349 return config_.max_context_length ;
350350}
351351
352- int32_t Runner::count_text_tokens (const std::string &text) const {
352+ size_t Runner::count_text_tokens (const std::string &text) const {
353353 auto encodeResult =
354354 tokenizer_->encode (text, numOfAddedBoSTokens, numOfAddedEoSTokens);
355355
@@ -359,7 +359,7 @@ int32_t Runner::count_text_tokens(const std::string &text) const {
359359 " Encoding failed during token count check." );
360360 }
361361
362- return static_cast < int32_t >( encodeResult.get ().size () );
362+ return encodeResult.get ().size ();
363363}
364364
365365int32_t Runner::resolve_max_new_tokens (int32_t num_prompt_tokens,
Original file line number Diff line number Diff line change @@ -50,8 +50,8 @@ class Runner : public llm::IRunner {
5050 void set_time_interval (size_t time_interval);
5151 void set_temperature (float temperature) noexcept ;
5252 void set_topp (float topp) noexcept ;
53- int32_t count_text_tokens (const std::string &text) const ;
54- int32_t get_max_context_length () const ;
53+ size_t count_text_tokens (const std::string &text) const ;
54+ size_t get_max_context_length () const ;
5555
5656 void stop () override ;
5757 void reset () override ;
You can’t perform that action at this time.
0 commit comments