-
Notifications
You must be signed in to change notification settings - Fork 27.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ModernBERT inference fails on CPU: ValueError: Pointer argument (at 0) cannot be accessed from Triton (cpu tensor?) #35388
Comments
Related AnswerDotAI/ModernBERT#152 |
Hint: in the traceback, you see this line: 199 # Need this, otherwise Triton tries to launch from cuda:0 and we get
200 # ValueError: Pointer argument (at 0) cannot be accessed from Triton (cpu tensor?)
201 with torch.cuda.device(x.device.index):
--> 202 rotary_kernel[grid](
203 output, # data ptrs
204 x,
205 cos,
206 sin,
207 cu_seqlens,
208 seqlen_offsets,
209 seqlen, # shapes
210 rotary_dim,
211 seqlen_ro,
212 output.stride(0) if not is_varlen else 0, # batch_strides if not varlen else 0
213 output.stride(-3), # seqlen_stride or total_seqlen_stride
214 output.stride(-2), # nheads_stride
215 output.stride(-1), # headdim_stride
216 x.stride(0) if not is_varlen else 0, # batch_strides if not varlen else 0
217 x.stride(-3), # seqlen stride or total_seqlen_stride
218 x.stride(-2), # nheads stride
219 x.stride(-1), # headdim stride
220 BLOCK_K,
221 isinstance(seqlen_offsets, torch.Tensor),
222 is_varlen,
223 interleaved,
224 conjugate,
225 BLOCK_M,
226 )
227 return output So it seems this error is known about but the fix didn't work? |
I can confirm i have the same error on CPU for modern bert |
This was resolved thanks to https://huggingface.co/answerdotai/ModernBERT-base/discussions/10
|
@umarbutler Well, you are trying to launch trition kernels on CPU. Triton does not work. The modeling code seems to assume to use the tuition kernel, if a cpu is available. I would try to set |
System Info
transformers
version: 4.48.0.dev0Who can help?
@Rocketknight1 @arthu
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
When one runs the below code, taken exactly from the Hugging Face ModernBERT's README except for the addition of
device = 'cpu'
, they get the errorValueError: Pointer argument (at 0) cannot be accessed from Triton (cpu tensor?)
:Here is the full traceback of the error:
Expected behavior
It works.
The text was updated successfully, but these errors were encountered: