diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b00368fb..dd6d7c99 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - build: [linux-debug, linux-release, macos-debug, macos-release, windows-debug, windows-release] + build: [linux-debug, linux-release, windows-debug, windows-release] include: - build: linux-debug os: ubuntu-latest @@ -20,12 +20,12 @@ jobs: - build: linux-release os: ubuntu-latest config: release - - build: macos-debug - os: macos-latest - config: debug - - build: macos-release - os: macos-latest - config: release + # - build: macos-debug + # os: macos-latest + # config: debug + # - build: macos-release + # os: macos-latest + # config: release - build: windows-debug os: windows-2019 config: debug diff --git a/LLama/Common/FixedSizeQueue.cs b/LLama/Common/FixedSizeQueue.cs index 4b082feb..7e685777 100644 --- a/LLama/Common/FixedSizeQueue.cs +++ b/LLama/Common/FixedSizeQueue.cs @@ -30,8 +30,11 @@ namespace LLama.Common /// public FixedSizeQueue(int size, IEnumerable data) { -#if NETCOREAPP3_0_OR_GREATER - // Try an early check on the amount of data supplied (if possible) +#if NETSTANDARD2_0 + var dataCount = data.Count(); + if (data.Count() > size) + throw new ArgumentException($"The max size set for the quene is {size}, but got {dataCount} initial values."); +#else if (data.TryGetNonEnumeratedCount(out var count) && count > size) throw new ArgumentException($"The max size set for the quene is {size}, but got {count} initial values."); #endif @@ -42,9 +45,12 @@ namespace LLama.Common // Now check if that list is a valid size if (_storage.Count > _maxSize) - throw new ArgumentException($"The max size set for the quene is {size}, but got {_storage.Count} initial values."); +#if NETSTANDARD2_0 + throw new ArgumentException($"The max size set for the quene is {size}, but got {dataCount} initial values."); +#else + throw new ArgumentException($"The max size set for the quene is {size}, but got {count} initial values."); +#endif } - /// /// Replace every item in the queue with the given value /// diff --git a/LLama/LLamaSharp.Runtime.targets b/LLama/LLamaSharp.Runtime.targets index 8910f155..e83b11ac 100644 --- a/LLama/LLamaSharp.Runtime.targets +++ b/LLama/LLamaSharp.Runtime.targets @@ -31,6 +31,10 @@ PreserveNewest libllama.dylib + + PreserveNewest + libllama-metal.dylib + PreserveNewest ggml-metal.metal diff --git a/LLama/Native/NativeApi.cs b/LLama/Native/NativeApi.cs index 527bea52..4e0ac2a2 100644 --- a/LLama/Native/NativeApi.cs +++ b/LLama/Native/NativeApi.cs @@ -21,7 +21,8 @@ namespace LLama.Native "1. No LLamaSharp backend was installed. Please search LLamaSharp.Backend and install one of them. \n" + "2. You are using a device with only CPU but installed cuda backend. Please install cpu backend instead. \n" + "3. The backend is not compatible with your system cuda environment. Please check and fix it. If the environment is " + - "expected not to be changed, then consider build llama.cpp from source or submit an issue to LLamaSharp."); + "expected not to be changed, then consider build llama.cpp from source or submit an issue to LLamaSharp.\n" + + "4. One of the dependency of the native library is missed.\n"); } NativeApi.llama_backend_init(false); } diff --git a/LLama/runtimes/libllama-cuda11.dll b/LLama/runtimes/libllama-cuda11.dll index 95b34dae..81af173b 100644 Binary files a/LLama/runtimes/libllama-cuda11.dll and b/LLama/runtimes/libllama-cuda11.dll differ diff --git a/LLama/runtimes/libllama-cuda11.so b/LLama/runtimes/libllama-cuda11.so index 508b4e1b..75b884dd 100644 Binary files a/LLama/runtimes/libllama-cuda11.so and b/LLama/runtimes/libllama-cuda11.so differ diff --git a/LLama/runtimes/libllama-cuda12.dll b/LLama/runtimes/libllama-cuda12.dll index 97c1a9b1..e6ff0a30 100644 Binary files a/LLama/runtimes/libllama-cuda12.dll and b/LLama/runtimes/libllama-cuda12.dll differ diff --git a/LLama/runtimes/libllama-cuda12.so b/LLama/runtimes/libllama-cuda12.so index bcb7d3ad..6d20557b 100644 Binary files a/LLama/runtimes/libllama-cuda12.so and b/LLama/runtimes/libllama-cuda12.so differ diff --git a/LLama/runtimes/libllama-metal.dylib b/LLama/runtimes/libllama-metal.dylib new file mode 100644 index 00000000..7cd1f4ab Binary files /dev/null and b/LLama/runtimes/libllama-metal.dylib differ diff --git a/LLama/runtimes/libllama.dll b/LLama/runtimes/libllama.dll index 6b9e5f9d..8432f664 100644 Binary files a/LLama/runtimes/libllama.dll and b/LLama/runtimes/libllama.dll differ diff --git a/LLama/runtimes/libllama.dylib b/LLama/runtimes/libllama.dylib old mode 100755 new mode 100644 index 12e40e98..e4d0f1c7 Binary files a/LLama/runtimes/libllama.dylib and b/LLama/runtimes/libllama.dylib differ diff --git a/LLama/runtimes/libllama.so b/LLama/runtimes/libllama.so index 5acc506a..1d7226a6 100644 Binary files a/LLama/runtimes/libllama.so and b/LLama/runtimes/libllama.so differ