2024-06-13 23:18:08 +08:00
|
|
|
import torch
|
|
|
|
|
|
|
|
|
|
from vllm.model_executor.layers.quantization import QUANTIZATION_METHODS
|
2024-07-03 11:12:22 +08:00
|
|
|
from vllm.platforms import current_platform
|
2024-06-13 23:18:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def is_quant_method_supported(quant_method: str) -> bool:
|
|
|
|
|
# Currently, all quantization methods require Nvidia or AMD GPUs
|
|
|
|
|
if not torch.cuda.is_available():
|
|
|
|
|
return False
|
|
|
|
|
|
2024-07-03 11:12:22 +08:00
|
|
|
capability = current_platform.get_device_capability()
|
2024-06-13 23:18:08 +08:00
|
|
|
capability = capability[0] * 10 + capability[1]
|
2024-06-16 22:07:34 +08:00
|
|
|
return (capability >=
|
2024-06-13 23:18:08 +08:00
|
|
|
QUANTIZATION_METHODS[quant_method].get_min_capability())
|