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 2.4 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using LLama;
  2. using LLama.Abstractions.Params;
  3. using LLama.Examples;
  4. using LLama.Examples.Old;
  5. Console.WriteLine("======================================================================================================");
  6. Console.WriteLine(" __ __ ____ __ \r\n/\\ \\ /\\ \\ /\\ _`\\ /\\ \\ \r\n\\ \\ \\ \\ \\ \\ __ ___ ___ __ \\ \\,\\L\\_\\\\ \\ \\___ __ _ __ _____ \r\n \\ \\ \\ __\\ \\ \\ __ /'__`\\ /' __` __`\\ /'__`\\ \\/_\\__ \\ \\ \\ _ `\\ /'__`\\ /\\`'__\\/\\ '__`\\ \r\n \\ \\ \\L\\ \\\\ \\ \\L\\ \\/\\ \\L\\.\\_ /\\ \\/\\ \\/\\ \\ /\\ \\L\\.\\_ /\\ \\L\\ \\\\ \\ \\ \\ \\ /\\ \\L\\.\\_\\ \\ \\/ \\ \\ \\L\\ \\\r\n \\ \\____/ \\ \\____/\\ \\__/.\\_\\\\ \\_\\ \\_\\ \\_\\\\ \\__/.\\_\\\\ `\\____\\\\ \\_\\ \\_\\\\ \\__/.\\_\\\\ \\_\\ \\ \\ ,__/\r\n \\/___/ \\/___/ \\/__/\\/_/ \\/_/\\/_/\\/_/ \\/__/\\/_/ \\/_____/ \\/_/\\/_/ \\/__/\\/_/ \\/_/ \\ \\ \\/ \r\n \\ \\_\\ \r\n \\/_/ ");
  7. Console.WriteLine("======================================================================================================");
  8. Console.WriteLine();
  9. Console.WriteLine("Please choose the version you want to test: ");
  10. Console.WriteLine("0. old version (for v0.3.0 or earlier version)");
  11. Console.WriteLine("1. new version (for versions after v0.4.0)");
  12. Console.Write("\nYour Choice: ");
  13. int version = int.Parse(Console.ReadLine());
  14. Console.WriteLine();
  15. if(version == 1)
  16. {
  17. Console.WriteLine("The examples for new versions are under working now. We'll soon update the examples." +
  18. " Thank you for your support!");
  19. string modelPath = "D:\\development\\llama\\weights\\wizard-vicuna-13B.ggmlv3.q4_1.bin";
  20. var prompt = File.ReadAllText("Assets/dan.txt").Trim();
  21. LLamaInstructExecutor ex = new(new LLamaModel(new ModelParams(modelPath, contextSize: 1024)));
  22. while (true)
  23. {
  24. foreach (var text in ex.Infer(prompt, new SessionParams() { Temperature = 0.6f }))
  25. {
  26. Console.Write(text);
  27. }
  28. prompt = Console.ReadLine();
  29. }
  30. }
  31. else
  32. {
  33. OldTestRunner.Run();
  34. }

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