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.8 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. /// <summary>
  47. /// disable k-quant mixtures and quantize all tensors to the same type
  48. /// </summary>
  49. public bool pure
  50. {
  51. get => Convert.ToBoolean(_pure);
  52. set => _pure = Convert.ToSByte(value);
  53. }
  54. private sbyte _pure;
  55. }
  56. }