Skip to content

Commit 0247872

Browse files
authored
SetDllImportResolver based loading (#603)
- 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`
1 parent 6ddd45b commit 0247872

File tree

3 files changed

+298
-160
lines changed

3 files changed

+298
-160
lines changed

LLama.Examples/Program.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ __ __ ____ __
1616
1717
""");
1818

19+
// Configure native library to use
1920
NativeLibraryConfig
2021
.Instance
2122
.WithCuda()
22-
.WithLogs(LLamaLogLevel.Warning);
23+
.WithLogs(LLamaLogLevel.Info);
2324

25+
// Calling this method forces loading to occur now.
2426
NativeApi.llama_empty_call();
2527

26-
await ExampleRunner.Run();
28+
await ExampleRunner.Run();
29+

0 commit comments

Comments
 (0)