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.

QuantizeModel.cs 937 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. namespace LLama.Examples.NewVersion
  8. {
  9. public class QuantizeModel
  10. {
  11. public static void Run()
  12. {
  13. Console.Write("Please input your original model path: ");
  14. var inputPath = Console.ReadLine();
  15. Console.Write("Please input your output model path: ");
  16. var outputPath = Console.ReadLine();
  17. Console.Write("Please input the quantize type (one of q4_0, q4_1, q5_0, q5_1, q8_0): ");
  18. var quantizeType = Console.ReadLine();
  19. if (LLamaQuantizer.Quantize(inputPath, outputPath, quantizeType))
  20. {
  21. Console.WriteLine("Quantization succeed!");
  22. }
  23. else
  24. {
  25. Console.WriteLine("Quantization failed!");
  26. }
  27. }
  28. }
  29. }

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