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

1234567891011121314151617181920212223242526272829303132333435363738
  1. using LLama.Native;
  2. using Spectre.Console;
  3. AnsiConsole.MarkupLineInterpolated(
  4. $"""
  5. [purple]======================================================================================================[/]
  6. __ __ ____ __
  7. /\ \ /\ \ /\ _`\ /\ \
  8. \ \ \ \ \ \ __ ___ ___ __ \ \,\L\_\\ \ \___ __ _ __ _____
  9. \ \ \ __\ \ \ __ /'__`\ /' __` __`\ /'__`\ \/_\__ \ \ \ _ `\ /'__`\ /\` __\/\ __`\
  10. \ \ \L\ \\ \ \L\ \/\ \L\.\_ /\ \/\ \/\ \ /\ \L\.\_ /\ \L\ \\ \ \ \ \ /\ \L\.\_\ \ \/ \ \ \L\ \
  11. \ \____/ \ \____/\ \__/.\_\\ \_\ \_\ \_\\ \__/.\_\\ `\____\\ \_\ \_\\ \__/.\_\\ \_\ \ \ ,__/
  12. \/___/ \/___/ \/__/\/_/ \/_/\/_/\/_/ \/__/\/_/ \/_____/ \/_/\/_/ \/__/\/_/ \/_/ \ \ \/
  13. [purple]=========================================================================================[/] \ \_\ [purple]======[/]
  14. \/_/
  15. """);
  16. // Configure native library to use. This must be done before any other llama.cpp methods are called!
  17. NativeLibraryConfig
  18. .Instance
  19. .WithCuda();
  20. // Configure logging. Change this to `true` to see log messages from llama.cpp
  21. var showLLamaCppLogs = false;
  22. NativeLibraryConfig
  23. .Instance
  24. .WithLogCallback((level, message) =>
  25. {
  26. if (showLLamaCppLogs)
  27. Console.WriteLine($"[llama {level}]: {message.TrimEnd('\n')}");
  28. });
  29. // Calling this method forces loading to occur now.
  30. NativeApi.llama_empty_call();
  31. await ExampleRunner.Run();