From 400c7d471195f2af5a43bfcbfa3750ab1569893c Mon Sep 17 00:00:00 2001 From: Martin Evans Date: Sat, 9 Sep 2023 16:19:27 +0100 Subject: [PATCH] Fixed readme example code --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6229123d..c959068a 100644 --- a/README.md +++ b/README.md @@ -84,8 +84,18 @@ using LLama; string modelPath = ""; // change it to your own model path var prompt = "Transcript of a dialog, where the User interacts with an Assistant named Bob. Bob is helpful, kind, honest, good at writing, and never fails to answer the User's requests immediately and with precision.\r\n\r\nUser: Hello, Bob.\r\nBob: Hello. How may I help you today?\r\nUser: Please tell me the largest city in Europe.\r\nBob: Sure. The largest city in Europe is Moscow, the capital of Russia.\r\nUser:"; // use the "chat-with-bob" prompt here. +// Load a model +var parameters = new ModelParams(modelPath) +{ + ContextSize = 1024, + Seed = 1337, + GpuLayerCount = 5 +}; +using var model = LLamaWeights.LoadFromFile(parameters); + // Initialize a chat session -var ex = new InteractiveExecutor(new LLamaModel(new ModelParams(modelPath, contextSize: 1024, seed: 1337, gpuLayerCount: 5))); +using var context = model.CreateContext(parameters); +var ex = new InteractiveExecutor(context); ChatSession session = new ChatSession(ex); // show the prompt