Skip to content

Commit

Permalink
SetDllImportResolver based loading (#603)
Browse files Browse the repository at this point in the history
 - Modified library loading to be based on `SetDllImportResolver`. This replaces the built in loading system and ensures there can't be two libraries loaded at once.
 - llava and llama are loaded separately, as needed.
 - All the previous loading logic is still used, within the `SetDllImportResolver`
 - Split out CUDA, AVX and MacOS paths to separate helper methods.
 - `Description` now specifies if it is for `llama` or `llava`
  • Loading branch information
martindevans authored Mar 17, 2024
1 parent 6ddd45b commit 0247872
Show file tree
Hide file tree
Showing 3 changed files with 298 additions and 160 deletions.
7 changes: 5 additions & 2 deletions LLama.Examples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ __ __ ____ __

""");

// Configure native library to use
NativeLibraryConfig
.Instance
.WithCuda()
.WithLogs(LLamaLogLevel.Warning);
.WithLogs(LLamaLogLevel.Info);

// Calling this method forces loading to occur now.
NativeApi.llama_empty_call();

await ExampleRunner.Run();
await ExampleRunner.Run();

Loading

0 comments on commit 0247872

Please sign in to comment.