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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. while (true)
  20. {
  21. Console.Write("\nYour choice: ");
  22. int choice = int.Parse(Console.ReadLine());
  23. if (choice == 0)
  24. {
  25. ChatSessionWithRoleName.Run();
  26. }
  27. else if (choice == 1)
  28. {
  29. ChatSessionStripRoleName.Run();
  30. }
  31. else if(choice == 2)
  32. {
  33. await InteractiveModeExecute.Run();
  34. }
  35. else if(choice == 3)
  36. {
  37. InstructModeExecute.Run();
  38. }
  39. else if(choice == 4)
  40. {
  41. StatelessModeExecute.Run();
  42. }
  43. else if(choice == 5)
  44. {
  45. SaveAndLoadSession.Run();
  46. }
  47. else if(choice == 6)
  48. {
  49. LoadAndSaveState.Run();
  50. }
  51. else if(choice == 7)
  52. {
  53. GetEmbeddings.Run();
  54. }
  55. else if(choice == 8)
  56. {
  57. QuantizeModel.Run();
  58. }
  59. else if (choice == 9)
  60. {
  61. await TalkToYourself.Run();
  62. }
  63. else
  64. {
  65. Console.WriteLine("Cannot parse your choice. Please select again.");
  66. continue;
  67. }
  68. break;
  69. }
  70. }
  71. }
  72. }