RuntimeError: Tensor device mismatch … found at least two devices, neuron:0 and cpu! (scaled_dot_product_attention)

这个报错通常出现在 Transformers 的 generate() 使用 cache_implementation="static" 时:如果输入张量留在 CPU(host-side),而模型已在加速设备(如 neuron:0)上,嵌套在 dict 里的 attention mask 张量不会被








