[Misc] Auto fallback to float16 for pre-Ampere GPUs when detected bfloat16 config (#17265)
Signed-off-by: Isotr0py <2037008807@qq.com>
This commit is contained in:
@@ -73,6 +73,19 @@ class CudaPlatformBase(Platform):
|
||||
ray_device_key: str = "GPU"
|
||||
device_control_env_var: str = "CUDA_VISIBLE_DEVICES"
|
||||
|
||||
@property
|
||||
def supported_dtypes(self) -> List[torch.dtype]:
|
||||
if self.has_device_capability(80):
|
||||
# Ampere and Hopper or later NVIDIA GPUs.
|
||||
return [torch.bfloat16, torch.float16, torch.float32]
|
||||
elif (not self.has_device_capability(80)
|
||||
) and self.has_device_capability(60):
|
||||
# Pascal, Volta and Turing NVIDIA GPUs, BF16 is not supported
|
||||
return [torch.float16, torch.float32]
|
||||
# Kepler and Maxwell NVIDIA GPUs, only FP32 is supported,
|
||||
# though vLLM doesn't support these GPUs.
|
||||
return [torch.float32]
|
||||
|
||||
@classmethod
|
||||
def get_device_capability(cls,
|
||||
device_id: int = 0
|
||||
|
||||
Reference in New Issue
Block a user