BotSharp/src/Infrastructure/BotSharp.Core/Plugins/LLamaSharp/LlamaAiModel.cs

33 lines
663 B
C#
Raw Normal View History

2023-06-27 19:17:53 +00:00
using LLama;
2023-06-27 23:36:50 +00:00
using LLama.Common;
2023-06-27 19:17:53 +00:00
namespace BotSharp.Core.Plugins.LLamaSharp;
public class LlamaAiModel
{
private readonly LlamaSharpSettings _settings;
2023-06-27 23:36:50 +00:00
public LlamaSharpSettings Settings => _settings;
2023-06-27 19:17:53 +00:00
LLamaModel _model;
public LLamaModel Model => _model;
public LlamaAiModel(LlamaSharpSettings settings)
{
_settings = settings;
}
public void LoadModel()
{
if (_model != null)
{
return;
}
2023-06-27 23:36:50 +00:00
_model = new LLamaModel(new ModelParams(_settings.ModelPath,
contextSize: _settings.MaxContextLength,
gpuLayerCount: _settings.NumberOfGpuLayer));
2023-06-27 19:17:53 +00:00
}
}