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 2.0 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. /// <remarks>llama_model_quantize_params</remarks>
  9. [StructLayout(LayoutKind.Sequential)]
  10. public struct LLamaModelQuantizeParams
  11. {
  12. /// <summary>
  13. /// number of threads to use for quantizing, if &lt;=0 will use std::thread::hardware_concurrency()
  14. /// </summary>
  15. public int nthread;
  16. /// <summary>
  17. /// quantize to this llama_ftype
  18. /// </summary>
  19. public LLamaFtype ftype;
  20. /// <summary>
  21. /// allow quantizing non-f32/f16 tensors
  22. /// </summary>
  23. public bool allow_requantize
  24. {
  25. get => Convert.ToBoolean(_allow_requantize);
  26. set => _allow_requantize = Convert.ToSByte(value);
  27. }
  28. private sbyte _allow_requantize;
  29. /// <summary>
  30. /// quantize output.weight
  31. /// </summary>
  32. public bool quantize_output_tensor
  33. {
  34. get => Convert.ToBoolean(_quantize_output_tensor);
  35. set => _quantize_output_tensor = Convert.ToSByte(value);
  36. }
  37. private sbyte _quantize_output_tensor;
  38. /// <summary>
  39. /// only copy tensors - ftype, allow_requantize and quantize_output_tensor are ignored
  40. /// </summary>
  41. public bool only_copy
  42. {
  43. get => Convert.ToBoolean(_only_copy);
  44. set => _only_copy = Convert.ToSByte(value);
  45. }
  46. private sbyte _only_copy;
  47. /// <summary>
  48. /// disable k-quant mixtures and quantize all tensors to the same type
  49. /// </summary>
  50. public bool pure
  51. {
  52. get => Convert.ToBoolean(_pure);
  53. set => _pure = Convert.ToSByte(value);
  54. }
  55. private sbyte _pure;
  56. /// <summary>
  57. /// pointer to importance matrix data
  58. /// </summary>
  59. public IntPtr imatrix;
  60. }
  61. }