__init__.py 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. from typing import Type
  2. from aphrodite.quantization.aqlm import AQLMConfig
  3. from aphrodite.quantization.awq import AWQConfig
  4. from aphrodite.quantization.awq_marlin import AWQMarlinConfig
  5. from aphrodite.quantization.base_config import QuantizationConfig
  6. from aphrodite.quantization.bitsandbytes import BitsAndBytesConfig
  7. from aphrodite.quantization.compressed_tensors.compressed_tensors import (
  8. CompressedTensorsConfig)
  9. from aphrodite.quantization.deepspeedfp import DeepSpeedFPConfig
  10. from aphrodite.quantization.eetq import EETQConfig
  11. from aphrodite.quantization.experts_int8 import ExpertsInt8Config
  12. from aphrodite.quantization.fbgemm_fp8 import FBGEMMFp8Config
  13. from aphrodite.quantization.fp8 import Fp8Config
  14. from aphrodite.quantization.gguf import GGUFConfig
  15. from aphrodite.quantization.gptq import GPTQConfig
  16. from aphrodite.quantization.gptq_marlin import GPTQMarlinConfig
  17. from aphrodite.quantization.gptq_marlin_24 import GPTQMarlin24Config
  18. from aphrodite.quantization.marlin import MarlinConfig
  19. from aphrodite.quantization.qqq import QQQConfig
  20. from aphrodite.quantization.quip import QuipConfig
  21. from aphrodite.quantization.squeezellm import SqueezeLLMConfig
  22. from aphrodite.quantization.tpu_int8 import Int8TpuConfig
  23. QUANTIZATION_METHODS = {
  24. "aqlm": AQLMConfig,
  25. "awq": AWQConfig,
  26. "deepspeedfp": DeepSpeedFPConfig,
  27. "tpu_int8": Int8TpuConfig,
  28. "eetq": EETQConfig,
  29. "fp8": Fp8Config,
  30. "fbgemm_fp8": FBGEMMFp8Config,
  31. "gguf": GGUFConfig,
  32. # The order of gptq methods is important for config.py iteration over
  33. # override_quantization_method(..)
  34. "marlin": MarlinConfig,
  35. "gptq_marlin_24": GPTQMarlin24Config,
  36. "gptq_marlin": GPTQMarlinConfig,
  37. "awq_marlin": AWQMarlinConfig,
  38. "gptq": GPTQConfig,
  39. "quip": QuipConfig,
  40. "squeezellm": SqueezeLLMConfig,
  41. "compressed-tensors": CompressedTensorsConfig,
  42. "bitsandbytes": BitsAndBytesConfig,
  43. "qqq": QQQConfig,
  44. "experts_int8": ExpertsInt8Config,
  45. }
  46. def get_quantization_config(quantization: str) -> Type[QuantizationConfig]:
  47. if quantization not in QUANTIZATION_METHODS:
  48. raise ValueError(f"Invalid quantization method: {quantization}")
  49. return QUANTIZATION_METHODS[quantization]
  50. __all__ = [
  51. "QuantizationConfig",
  52. "get_quantization_config",
  53. "QUANTIZATION_METHODS",
  54. ]