Browse Source

Added conditional compilation code to progress_callback (in LlamaModelParams struct) so the struct plays nice with legacy NET Framework 4.8 (#593)

tags/0.11.0
Clovis Henrique Ribeiro GitHub 1 year ago
parent
commit
d0f79814e9
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      LLama/Native/LLamaModelParams.cs

+ 8
- 2
LLama/Native/LLamaModelParams.cs View File

@@ -27,13 +27,19 @@ namespace LLama.Native
/// <summary>
/// how to split layers across multiple GPUs (size: <see cref="NativeApi.llama_max_devices"/>)
/// </summary>
public float* tensor_split;
public float* tensor_split;
/// <summary>
/// called with a progress value between 0 and 1, pass NULL to disable. If the provided progress_callback
/// returns true, model loading continues. If it returns false, model loading is immediately aborted.
/// </summary>
#if NETSTANDARD2_0
// this code is intended to be used when running LlamaSharp on NET Framework 4.8 (NET Standard 2.0)
// as NET Framework 4.8 does not play nice with the LlamaProgressCallback type
public IntPtr progress_callback;
#else
public LlamaProgressCallback progress_callback;
#endif

/// <summary>
/// context pointer passed to the progress callback


Loading…
Cancel
Save