Skip to content

Commit

Permalink
fix: rename metal resource & gguf_ defs for avoid conflit with llama.rn
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Oct 25, 2023
1 parent 57c08c9 commit d45e235
Show file tree
Hide file tree
Showing 6 changed files with 426 additions and 412 deletions.
File renamed without changes.
10 changes: 5 additions & 5 deletions cpp/ggml-metal.m
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@
static NSString * const msl_library_source = @"see metal.metal";

// Here to assist with NSBundle Path Hack
@interface GGMLMetalClass : NSObject
@interface WSPGGMLMetalClass : NSObject
@end
@implementation GGMLMetalClass
@implementation WSPGGMLMetalClass
@end

struct wsp_ggml_metal_context * wsp_ggml_metal_init(int n_cb) {
Expand Down Expand Up @@ -155,7 +155,7 @@ @implementation GGMLMetalClass
{
NSError * error = nil;

NSBundle * bundle = [NSBundle bundleForClass:[GGMLMetalClass class]];
NSBundle * bundle = [NSBundle bundleForClass:[WSPGGMLMetalClass class]];
NSString * llamaBundlePath = [bundle pathForResource:@"llama_llama" ofType:@"bundle"];
NSBundle * llamaBundle = [NSBundle bundleWithPath:llamaBundlePath];
NSString * libPath = [llamaBundle pathForResource:@"default" ofType:@"metallib"];
Expand All @@ -177,8 +177,8 @@ @implementation GGMLMetalClass
NSError * error = nil;

//NSString * path = [[NSBundle mainBundle] pathForResource:@"../../examples/metal/metal" ofType:@"metal"];
NSBundle * bundle = [NSBundle bundleForClass:[GGMLMetalClass class]];
NSString * path = [bundle pathForResource:@"ggml-metal" ofType:@"metal"];
NSBundle * bundle = [NSBundle bundleForClass:[WSPGGMLMetalClass class]];
NSString * path = [bundle pathForResource:@"ggml-metal-whisper" ofType:@"metal"];
metal_printf("%s: loading '%s'\n", __func__, [path UTF8String]);

NSString * src = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error];
Expand Down
Loading

0 comments on commit d45e235

Please sign in to comment.