You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Program.cs 731 B

12345678910111213141516
  1. using LLama;
  2. using LLama.Types;
  3. string modelPath = @"D:\development\llama\weights\LLaMA\7B\ggml-model-q4_0.bin";
  4. LLamaModel model = new(modelPath, logits_all: false, verbose: false);
  5. List<ChatCompletionMessage> chats = new List<ChatCompletionMessage>();
  6. chats.Add(new ChatCompletionMessage("user", "Hi, Alice, I'm Rinne.", null));
  7. chats.Add(new ChatCompletionMessage("assistant", "Hi, Rinne, I'm Alice. What can I do for you?", null));
  8. while (true)
  9. {
  10. Console.Write("You: ");
  11. var question = Console.ReadLine();
  12. chats.Add(new ChatCompletionMessage("user", question, null));
  13. var output = model.CreateChatCompletion(chats, max_tokens: 256);
  14. Console.WriteLine($"LLama AI: {output.Choices[0].Message.Content}");
  15. }

C#/.NET上易用的LLM高性能推理框架,支持LLaMA和LLaVA系列模型。

Contributors (1)