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.

LLamaModelQuantizeParams.cs 1.5 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using System.Runtime.InteropServices;
  3. namespace LLama.Native
  4. {
  5. /// <summary>
  6. /// Quantizer parameters used in the native API
  7. /// </summary>
  8. [StructLayout(LayoutKind.Sequential)]
  9. public struct LLamaModelQuantizeParams
  10. {
  11. /// <summary>
  12. /// number of threads to use for quantizing, if &lt;=0 will use std::thread::hardware_concurrency()
  13. /// </summary>
  14. public int nthread;
  15. /// <summary>
  16. /// quantize to this llama_ftype
  17. /// </summary>
  18. public LLamaFtype ftype;
  19. /// <summary>
  20. /// allow quantizing non-f32/f16 tensors
  21. /// </summary>
  22. public bool allow_requantize
  23. {
  24. get => Convert.ToBoolean(_allow_requantize);
  25. set => _allow_requantize = Convert.ToSByte(value);
  26. }
  27. private sbyte _allow_requantize;
  28. /// <summary>
  29. /// quantize output.weight
  30. /// </summary>
  31. public bool quantize_output_tensor
  32. {
  33. get => Convert.ToBoolean(_quantize_output_tensor);
  34. set => _quantize_output_tensor = Convert.ToSByte(value);
  35. }
  36. private sbyte _quantize_output_tensor;
  37. /// <summary>
  38. /// only copy tensors - ftype, allow_requantize and quantize_output_tensor are ignored
  39. /// </summary>
  40. public bool only_copy
  41. {
  42. get => Convert.ToBoolean(_only_copy);
  43. set => _only_copy = Convert.ToSByte(value);
  44. }
  45. private sbyte _only_copy;
  46. }
  47. }