Browse Source

Merge pull request #78 from SciSharp/rinne-dev

feat: update the llama backends.
tags/v0.4.2-preview
Rinne GitHub 2 years ago
parent
commit
bfe9cc8961
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 23 additions and 12 deletions
  1. +7
    -7
      .github/workflows/main.yml
  2. +10
    -4
      LLama/Common/FixedSizeQueue.cs
  3. +4
    -0
      LLama/LLamaSharp.Runtime.targets
  4. +2
    -1
      LLama/Native/NativeApi.cs
  5. BIN
      LLama/runtimes/libllama-cuda11.dll
  6. BIN
      LLama/runtimes/libllama-cuda11.so
  7. BIN
      LLama/runtimes/libllama-cuda12.dll
  8. BIN
      LLama/runtimes/libllama-cuda12.so
  9. BIN
      LLama/runtimes/libllama-metal.dylib
  10. BIN
      LLama/runtimes/libllama.dll
  11. BIN
      LLama/runtimes/libllama.dylib
  12. BIN
      LLama/runtimes/libllama.so

+ 7
- 7
.github/workflows/main.yml View File

@@ -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


+ 10
- 4
LLama/Common/FixedSizeQueue.cs View File

@@ -30,8 +30,11 @@ namespace LLama.Common
/// <param name="data"></param>
public FixedSizeQueue(int size, IEnumerable<T> 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
}

/// <summary>
/// Replace every item in the queue with the given value
/// </summary>


+ 4
- 0
LLama/LLamaSharp.Runtime.targets View File

@@ -31,6 +31,10 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>libllama.dylib</Link>
</None>
<None Include="$(MSBuildThisFileDirectory)runtimes/libllama-metal.dylib">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>libllama-metal.dylib</Link>
</None>
<None Include="$(MSBuildThisFileDirectory)runtimes/ggml-metal.metal">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>ggml-metal.metal</Link>


+ 2
- 1
LLama/Native/NativeApi.cs View File

@@ -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);
}


BIN
LLama/runtimes/libllama-cuda11.dll View File


BIN
LLama/runtimes/libllama-cuda11.so View File


BIN
LLama/runtimes/libllama-cuda12.dll View File


BIN
LLama/runtimes/libllama-cuda12.so View File


BIN
LLama/runtimes/libllama-metal.dylib View File


BIN
LLama/runtimes/libllama.dll View File


BIN
LLama/runtimes/libllama.dylib View File


BIN
LLama/runtimes/libllama.so View File


Loading…
Cancel
Save