add llamasharp 配置

This commit is contained in:
zyxucp
2024-06-08 11:04:14 +08:00
parent e72a6acd03
commit b3ea0c4e1a
5 changed files with 15 additions and 6 deletions

View File

@@ -120,7 +120,9 @@ model/xxx.gguf
"DirectoryPath": "D:\\git\\AntBlazor\\model"
},
"LLamaSharp": {
"RunType": "GPU"
"RunType": "GPU",
"ContextSize": 2048,
"GpuLayerCount": 20
},
"Login": {
"User": "admin",

View File

@@ -131,7 +131,9 @@ model/xxx.gguf
"DirectoryPath": "D:\\git\\AntBlazor\\model"
},
"LLamaSharp": {
"RunType": "GPU"
"RunType": "GPU",
"ContextSize": 2048,
"GpuLayerCount": 20
},
"Login": {
"User": "admin",

View File

@@ -1,4 +1,5 @@
using LLama;
using AntSK.Domain.Options;
using LLama;
using LLama.Common;
using LLamaSharp.KernelMemory;
@@ -29,9 +30,9 @@ namespace AntSK.Domain.Domain.Other
}
var parameters = new ModelParams(lsConfig.ModelPath)
{
ContextSize = lsConfig?.ContextSize ?? 2048,
ContextSize = LLamaSharpOption.ContextSize ?? 2048,
Seed = lsConfig?.Seed ?? 0,
GpuLayerCount = lsConfig?.GpuLayerCount ?? 20,
GpuLayerCount = LLamaSharpOption.GpuLayerCount ?? 20,
Embeddings = true
};
var weights = LLamaWeights.LoadFromFile(parameters);

View File

@@ -3,5 +3,7 @@
public class LLamaSharpOption
{
public static string RunType { get; set; }
public static uint? ContextSize { get; set; }
public static int? GpuLayerCount { get; set; }
}
}

View File

@@ -34,7 +34,9 @@
"TableNamePrefix": "km-"
},
"LLamaSharp": {
"RunType": "GPU"
"RunType": "GPU",
"ContextSize": 2048,
"GpuLayerCount": 20
},
"FileDir": {
"DirectoryPath": "D:\\model"