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 526 B

1234567891011121314151617181920212223
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using LLama.Old;
  7. namespace LLama.Examples
  8. {
  9. public class GetEmbeddings
  10. {
  11. LLamaEmbedder _embedder;
  12. public GetEmbeddings(string modelPath)
  13. {
  14. _embedder = new LLamaEmbedder(new LLamaParams(model: modelPath));
  15. }
  16. public void Run(string text)
  17. {
  18. Console.WriteLine(string.Join(", ", _embedder.GetEmbeddings(text)));
  19. }
  20. }
  21. }

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