Unverified Commit ed6ae1e3 authored by Xiao Li's avatar Xiao Li Committed by GitHub
Browse files

[AITER] [ROCm] Fix crash when loading llama4 model with old aiter version...


[AITER] [ROCm] Fix crash when loading llama4 model with old aiter version installed, fallback to forward_native implementation (#29124)
Signed-off-by: default avatarXiao Li <ilx@meta.com>
parent 9875be64
......@@ -60,6 +60,7 @@ class TopKTopPSampler(nn.Module):
logprobs_mode not in ("processed_logits", "processed_logprobs")
and rocm_aiter_ops.is_enabled()
):
try:
import aiter.ops.sampling # noqa: F401
self.aiter_ops = torch.ops.aiter
......@@ -67,6 +68,12 @@ class TopKTopPSampler(nn.Module):
"Using aiter sampler on ROCm (lazy import, sampling-only)."
)
self.forward = self.forward_hip
except ImportError:
logger.warning_once(
"aiter.ops.sampling is not available on ROCm. "
"Falling back to forward_native implementation."
)
self.forward = self.forward_native
else:
self.forward = self.forward_native
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment