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.9 kB

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