from __future__ import annotations MACHINE_TO_GPU_ALIAS = { "MTT S4000": "s4000", "Mthreads S4000": "s4000", "摩尔线程 S4000": "s4000", "Hygon K100": "k100", "海光 K100": "k100", "Kunlunxin P800": "p800", "Kunlunxin P-800": "p800", "昆仑芯 P800": "p800", "Biren 166M": "166m", "Biren 166m": "166m", "壁砺 166M": "166m", "壁砺166M": "166m", "Ascend 910B": "910b", "昇腾 910B": "910b", "Iluvatar BI100": "bi100", "Iluvatar BI150": "bi150", "MetaX C500": "c500", "Iluvatar MRV100": "mrv100", "Cambricon MLU370-X4": "mlu370-x4", "Cambricon MLU370-X8": "mlu370-x8", } def machine_to_gpu_alias(machine_name: str) -> str | None: return MACHINE_TO_GPU_ALIAS.get(machine_name.strip()) def parse_machine_names(raw: str) -> list[str]: return [item.strip() for item in raw.split(",") if item.strip()]