[Hardware][PowerPC] Prioritize bfloat16 for auto dtype on PowerPC (#58528)
Signed-off-by: Akash kaothalkar <akash.kaothalkar@ibm.com> Co-authored-by: Akash kaothalkar <akash.kaothalkar@ibm.com> Co-authored-by: Antigravity <antigravity@google.com> Co-authored-by: Li, Jiang <jiang1.li@intel.com>
This commit is contained in:
co-authored by
Akash kaothalkar
Antigravity
Li, Jiang <jiang1.li@intel.com>
parent
fb91712b38
commit
ae66f9a97c
@@ -26,7 +26,7 @@ from vllm.config.quantization import QuantizationConfigArgs
|
|||||||
from vllm.config.scheduler import RunnerType
|
from vllm.config.scheduler import RunnerType
|
||||||
from vllm.config.utils import config, getattr_iter
|
from vllm.config.utils import config, getattr_iter
|
||||||
from vllm.logger import init_logger
|
from vllm.logger import init_logger
|
||||||
from vllm.platforms import current_platform
|
from vllm.platforms import CpuArchEnum, current_platform
|
||||||
from vllm.tasks import PoolingTask, ScoreType, SupportedTask
|
from vllm.tasks import PoolingTask, ScoreType, SupportedTask
|
||||||
from vllm.transformers_utils.config import (
|
from vllm.transformers_utils.config import (
|
||||||
ConfigFormat,
|
ConfigFormat,
|
||||||
@@ -2419,6 +2419,12 @@ def _get_and_verify_dtype(
|
|||||||
config_dtype,
|
config_dtype,
|
||||||
is_pooling_model=is_pooling_model,
|
is_pooling_model=is_pooling_model,
|
||||||
)
|
)
|
||||||
|
if (
|
||||||
|
current_platform.is_cpu()
|
||||||
|
and current_platform.get_cpu_architecture() == CpuArchEnum.POWERPC
|
||||||
|
and torch_dtype in (torch.float16, torch.float32)
|
||||||
|
):
|
||||||
|
torch_dtype = torch.bfloat16
|
||||||
else:
|
else:
|
||||||
if dtype not in _STR_DTYPE_TO_TORCH_DTYPE:
|
if dtype not in _STR_DTYPE_TO_TORCH_DTYPE:
|
||||||
raise ValueError(f"Unknown dtype: {dtype!r}")
|
raise ValueError(f"Unknown dtype: {dtype!r}")
|
||||||
|
|||||||
Reference in New Issue
Block a user