From 1b5731f4f81bcd12ac25af1c0c015059f30b0a11 Mon Sep 17 00:00:00 2001 From: jhen Date: Fri, 26 Apr 2024 16:02:24 +0800 Subject: [PATCH] fix: type and key --- android/src/main/jni.cpp | 6 +++--- example/src/App.tsx | 1 + ios/RNLlamaContext.h | 4 ++-- ios/RNLlamaContext.mm | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/android/src/main/jni.cpp b/android/src/main/jni.cpp index 1bb305bb..68d6231f 100644 --- a/android/src/main/jni.cpp +++ b/android/src/main/jni.cpp @@ -209,9 +209,9 @@ Java_com_rnllama_LlamaContext_loadModelDetails( char desc[1024]; llama_model_desc(llama->model, desc, sizeof(desc)); - putString(env, result, "model_desc", desc); - putDouble(env, result, "model_size", llama_model_size(llama->model)); - putInt(env, result, "model_n_params", llama_model_n_params(llama->model)); + putString(env, result, "desc", desc); + putDouble(env, result, "size", llama_model_size(llama->model)); + putDouble(env, result, "nParams", llama_model_n_params(llama->model)); putMap(env, result, "metadata", meta); return reinterpret_cast(result); diff --git a/example/src/App.tsx b/example/src/App.tsx index 4799a4bd..b0e05555 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -110,6 +110,7 @@ export default function App() { }) .then((ctx) => { setContext(ctx) + console.log(ctx) addSystemMessage( `Context initialized! \n\nGPU: ${ctx.gpu ? 'YES' : 'NO'} (${ ctx.reasonNoGPU diff --git a/ios/RNLlamaContext.h b/ios/RNLlamaContext.h index 86f6d290..7e07c96f 100644 --- a/ios/RNLlamaContext.h +++ b/ios/RNLlamaContext.h @@ -10,7 +10,7 @@ bool is_model_loaded; NSString * model_desc; uint64_t model_size; - int model_n_params; + uint64_t model_n_params; NSDictionary * metadata; rnllama::llama_rn_context * llama; @@ -22,7 +22,7 @@ - (NSDictionary *)metadata; - (NSString *)modelDesc; - (uint64_t)modelSize; -- (int)modelNParams; +- (uint64_t)modelNParams; - (bool)isModelLoaded; - (bool)isPredicting; - (NSDictionary *)completion:(NSDictionary *)params onToken:(void (^)(NSMutableDictionary *tokenResult))onToken; diff --git a/ios/RNLlamaContext.mm b/ios/RNLlamaContext.mm index ef063ec8..fb912d73 100644 --- a/ios/RNLlamaContext.mm +++ b/ios/RNLlamaContext.mm @@ -122,11 +122,11 @@ - (NSString *)modelDesc { return model_desc; } -- (size_t)modelSize { +- (uint64_t)modelSize { return model_size; } -- (size_t)modelNParams { +- (uint64_t)modelNParams { return model_n_params; }