[Bugfix][CPU] Add placeholder to avoid import errors when using fused_moe ops on platforms without triton (#25137)

Signed-off-by: jiang1.li <jiang1.li@intel.com>
This commit is contained in:
Li, Jiang 2025-09-19 15:41:12 +08:00 committed by GitHub
parent 8c1d4acbfe
commit 825fdb11ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -78,3 +78,12 @@ if HAS_TRITON:
"TritonOrDeepGemmExperts",
"BatchedTritonOrDeepGemmExperts",
]
else:
# Some model classes directly use the custom ops. Add placeholders
# to avoid import errors.
def _raise_exception(method: str):
raise NotImplementedError(
f"{method} is not implemented as lack of triton.")
fused_topk = lambda *args, **kwargs: _raise_exception("fused_topk")
fused_experts = lambda *args, **kwargs: _raise_exception("fused_experts")