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.

SafeLLamaHandleBase.cs 816 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Runtime.InteropServices;
  4. using System.Text;
  5. namespace LLama.Native
  6. {
  7. public abstract class SafeLLamaHandleBase: SafeHandle
  8. {
  9. private protected SafeLLamaHandleBase()
  10. : base(IntPtr.Zero, ownsHandle: true)
  11. {
  12. }
  13. private protected SafeLLamaHandleBase(IntPtr handle)
  14. : base(IntPtr.Zero, ownsHandle: true)
  15. {
  16. SetHandle(handle);
  17. }
  18. private protected SafeLLamaHandleBase(IntPtr handle, bool ownsHandle)
  19. : base(IntPtr.Zero, ownsHandle)
  20. {
  21. SetHandle(handle);
  22. }
  23. public override bool IsInvalid => handle == IntPtr.Zero;
  24. public override string ToString()
  25. => $"0x{handle.ToString("x16")}";
  26. }
  27. }

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