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.

GetEmbeddings.cs 868 B

123456789101112131415161718192021222324252627282930
  1. using LLama.Common;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace LLama.Examples.NewVersion
  8. {
  9. public class GetEmbeddings
  10. {
  11. public static void Run()
  12. {
  13. Console.Write("Please input your model path: ");
  14. string modelPath = Console.ReadLine();
  15. var embedder = new LLamaEmbedder(new ModelParams(modelPath));
  16. while (true)
  17. {
  18. Console.Write("Please input your text: ");
  19. Console.ForegroundColor = ConsoleColor.Green;
  20. var text = Console.ReadLine();
  21. Console.ForegroundColor = ConsoleColor.White;
  22. Console.WriteLine(string.Join(", ", embedder.GetEmbeddings(text)));
  23. Console.WriteLine();
  24. }
  25. }
  26. }
  27. }