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.

LLamaContextTests.cs 925 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System.Text;
  2. using LLama.Common;
  3. namespace LLama.Unittest
  4. {
  5. public class LLamaContextTests
  6. : IDisposable
  7. {
  8. private readonly LLamaWeights _weights;
  9. private readonly LLamaContext _context;
  10. public LLamaContextTests()
  11. {
  12. var @params = new ModelParams("Models/llama-2-7b-chat.ggmlv3.q3_K_S.bin")
  13. {
  14. ContextSize = 768,
  15. };
  16. _weights = LLamaWeights.LoadFromFile(@params);
  17. _context = _weights.CreateContext(@params, Encoding.UTF8);
  18. }
  19. public void Dispose()
  20. {
  21. _weights.Dispose();
  22. _context.Dispose();
  23. }
  24. [Fact]
  25. public void CheckProperties()
  26. {
  27. Assert.Equal(768, _context.ContextSize);
  28. Assert.Equal(4096, _context.EmbeddingSize);
  29. Assert.Equal(32000, _context.VocabCount);
  30. }
  31. }
  32. }