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.

TestRunner.cs 2.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace LLama.Examples.NewVersion
  7. {
  8. public class NewVersionTestRunner
  9. {
  10. public static async Task Run()
  11. {
  12. Console.WriteLine("================LLamaSharp Examples (New Version)==================\n");
  13. Console.WriteLine("Please input a number to choose an example to run:");
  14. Console.WriteLine("0: Run a chat session without stripping the role names.");
  15. Console.WriteLine("1: Run a chat session with the role names strippped.");
  16. Console.WriteLine("2: Interactive mode chat by using executor.");
  17. Console.WriteLine("3: Instruct mode chat by using executor.");
  18. Console.WriteLine("4: Stateless mode chat by using executor.");
  19. Console.WriteLine("5: Load and save chat session.");
  20. Console.WriteLine("6: Load and save state of model and executor.");
  21. Console.WriteLine("7: Get embeddings from LLama model.");
  22. Console.WriteLine("8: Quantize the model.");
  23. while (true)
  24. {
  25. Console.Write("\nYour choice: ");
  26. int choice = int.Parse(Console.ReadLine());
  27. if (choice == 0)
  28. {
  29. ChatSessionWithRoleName.Run();
  30. }
  31. else if (choice == 1)
  32. {
  33. ChatSessionStripRoleName.Run();
  34. }
  35. else if(choice == 2)
  36. {
  37. await InteractiveModeExecute.Run();
  38. }
  39. else if(choice == 3)
  40. {
  41. InstructModeExecute.Run();
  42. }
  43. else if(choice == 4)
  44. {
  45. StatelessModeExecute.Run();
  46. }
  47. else if(choice == 5)
  48. {
  49. SaveAndLoadSession.Run();
  50. }
  51. else if(choice == 6)
  52. {
  53. LoadAndSaveState.Run();
  54. }
  55. else if(choice == 7)
  56. {
  57. GetEmbeddings.Run();
  58. }
  59. else if(choice == 8)
  60. {
  61. QuantizeModel.Run();
  62. }
  63. else
  64. {
  65. Console.WriteLine("Cannot parse your choice. Please select again.");
  66. continue;
  67. }
  68. break;
  69. }
  70. }
  71. }
  72. }

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