diff --git a/ios/RNLlamaContext.mm b/ios/RNLlamaContext.mm index 9f92d09..2a279dc 100644 --- a/ios/RNLlamaContext.mm +++ b/ios/RNLlamaContext.mm @@ -19,7 +19,7 @@ + (instancetype)initWithParams:(NSDictionary *)params { BOOL isMetalEnabled = false; NSString *reasonNoMetal = @""; defaultParams.n_gpu_layers = 0; - if (params[@"n_gpu_layers"]) { + if (params[@"n_gpu_layers"] && [params[@"n_gpu_layers"] intValue] > 0) { // Check ggml-metal availability NSError * error = nil; id device = MTLCreateSystemDefaultDevice();