Browse Source

feat: change default param of n_gpu_layers to 20.

tags/v0.3.0
Yaohui Liu 2 years ago
parent
commit
e77afa76d0
No known key found for this signature in database GPG Key ID: E86D01E1809BD23E
2 changed files with 6 additions and 4 deletions
  1. +4
    -2
      LLama/LLamaModel.cs
  2. +2
    -2
      LLama/LLamaParams.cs

+ 4
- 2
LLama/LLamaModel.cs View File

@@ -53,7 +53,8 @@ namespace LLama
public SafeLLamaContextHandle NativeHandle => _ctx;

/// <summary>
/// Please refer `LLamaParams` to find the meanings of each arg.
/// Please refer `LLamaParams` to find the meanings of each arg. Be sure to have set the `n_gpu_layers`, otherwise it will
/// load 20 layers to gpu by default.
/// </summary>
/// <param name="model_path">The model file path.</param>
/// <param name="model_name">The model name.</param>
@@ -159,7 +160,8 @@ namespace LLama
}

/// <summary>
///
/// Please refer `LLamaParams` to find the meanings of each arg. Be sure to have set the `n_gpu_layers`, otherwise it will
/// load 20 layers to gpu by default.
/// </summary>
/// <param name="params">The LLamaModel params</param>
/// <param name="name">Model name</param>


+ 2
- 2
LLama/LLamaParams.cs View File

@@ -12,7 +12,7 @@ namespace LLama
public int n_ctx = 512; // context size
public int n_batch = 512; // batch size for prompt processing (must be >=32 to use BLAS)
public int n_keep = 0; // number of tokens to keep from initial prompt
public int n_gpu_layers = 0; // number of layers to store in VRAM
public int n_gpu_layers = -1; // number of layers to store in VRAM

// sampling parameters
public Dictionary<llama_token, float> logit_bias; // logit bias for specific tokens
@@ -80,7 +80,7 @@ namespace LLama
this.n_ctx = n_ctx;
this.n_batch = n_batch;
this.n_keep = n_keep;
this.n_gpu_layers = n_gpu_layers == -1 ? int.MaxValue : n_gpu_layers;
this.n_gpu_layers = n_gpu_layers == -1 ? 20 : n_gpu_layers;

if (logit_bias == null)
{


Loading…
Cancel
Save