[GH-ISSUE #756] CUDA error: no kernel image is available for execution on the device #549

Closed
opened 2026-10-29 14:41:05 +00:00 by bsakaguchi · 5 comments
Owner

Originally created by @Liskarm on GitHub (Mar 1, 2025).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/756

Hello, I am encountering a RuntimeError: CUDA error: no kernel image is available for execution on the device while trying to run my script using the following command:
python ./ktransformers/local_chat.py --model_path /workspace/ktransformers/kt0.2.2config --gguf_path /workspace/ktggufpath --prompt_file /workspace/ktpromptpath --cpu_infer 65 --max_new_tokens 1000
My system configuration is as follows:
Intel Xeon Platinum 8171M (dual socket)
12-channel 1TB DDR4 memory
Here's the detailed traceback of the error:
Injecting model.layers.60 as default Injecting model.layers.60.self_attn as ktransformers.operators.attention . KDeepseekV2Attention Injecting model.layers.60.self_attn.q_a_proj as ktransformers.operators.linear . KTransformersLinear Injecting model.layers.60.self_attn.q_a_layernorm as default Injecting model.layers.60.self_attn.q_b_proj as ktransformers.operators.linear . KTransformersLinear Injecting model.layers.60.self_attn.kv_a_proj_with_mqa as ktransformers.operators.linear . KTransformersLinear Injecting model.layers.60.self_attn.kv_a_layernorm as default Injecting model.layers.60.self_attn.kv_b_proj as default Injecting model.layers.60.self_attn.o_proj as ktransformers.operators.linear . KTransformersLinear Injecting model.layers.60.self_attn.rotary_emb as ktransformers.operators.RoPE . YarnRotaryEmbeddingV3 Injecting model.layers.60.mlp as ktransformers.operators.experts . KDeepseekV3MoE Injecting model.layers.60.mlp.experts as ktransformers.operators.experts . KTransformersExperts Injecting model.layers.60.mlp.gate as ktransformers.operators.gate . KMoEGate Injecting model.layers.60.mlp.shared_experts as default Injecting model.layers.60.mlp.shared_experts.gate_proj as ktransformers.operators.linear . KTransformersLinear Injecting model.layers.60.mlp.shared_experts.up_proj as ktransformers.operators.linear . KTransformersLinear Injecting model.layers.60.mlp.shared_experts.down_proj as ktransformers.operators.linear . KTransformersLinear Injecting model.layers.60.mlp.shared_experts.act_fn as default Injecting model.layers.60.input_layernorm as default Injecting model.layers.60.post_attention_layernorm as default Injecting model.norm as default Injecting lm_head as ktransformers.operators.linear . KTransformersLinear Traceback (most recent call last): File "/workspace/ktransformers/./ktransformers/local_chat.py", line 183, in <module> fire.Fire(local_chat) File "/opt/conda/lib/python3.10/site-packages/fire/core.py", line 135, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "/opt/conda/lib/python3.10/site-packages/fire/core.py", line 468, in _Fire component, remaining_args = _CallAndUpdateTrace( File "/opt/conda/lib/python3.10/site-packages/fire/core.py", line 684, in _CallAndUpdateTrace component = fn(*varargs, **kwargs) File "/workspace/ktransformers/./ktransformers/local_chat.py", line 110, in local_chat optimize_and_load_gguf(model, optimize_config_path, gguf_path, config) File "/workspace/ktransformers/./ktransformers/optimize/optimize.py", line 130, in optimize_and_load_gguf load_weights(module.lm_head, gguf_loader, "lm_head.") File "/workspace/ktransformers/./ktransformers/util/utils.py", line 111, in load_weights module.load() File "/workspace/ktransformers/./ktransformers/operators/linear.py", line 522, in load self.generate_linear.load(w=w) File "/workspace/ktransformers/./ktransformers/operators/linear.py", line 279, in load w = self.load_weight(device=device) File "/workspace/ktransformers/./ktransformers/operators/linear.py", line 97, in load_weight tensors = self.load_multi(key, ["weight"], device=device) File "/workspace/ktransformers/./ktransformers/operators/linear.py", line 107, in load_multi tensors[k] = self.gguf_loader.load_gguf_tensor(key + "." + k, device=device) File "/workspace/ktransformers/./ktransformers/util/custom_gguf.py", line 376, in load_gguf_tensor values[blocks_begin : blocks_end] = cur_values RuntimeError: CUDA error: no kernel image is available for execution on the device Compile with TORCH_USE_CUDA_DSA` to enable device-side assertions.

bash: syntax error near unexpected token newline'

I have already ensured that my cuda and pytorch installations allright. Could someone please help me resolve this issue? Any suggestions or solutions would be greatly appreciated.

Originally created by @Liskarm on GitHub (Mar 1, 2025). Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/756 Hello, I am encountering a RuntimeError: `CUDA error: no kernel image is available for execution on the device` while trying to run my script using the following command: `python ./ktransformers/local_chat.py --model_path /workspace/ktransformers/kt0.2.2config --gguf_path /workspace/ktggufpath --prompt_file /workspace/ktpromptpath --cpu_infer 65 --max_new_tokens 1000` My system configuration is as follows: Intel Xeon Platinum 8171M (dual socket) 12-channel 1TB DDR4 memory Here's the detailed traceback of the error: `Injecting model.layers.60 as default Injecting model.layers.60.self_attn as ktransformers.operators.attention . KDeepseekV2Attention Injecting model.layers.60.self_attn.q_a_proj as ktransformers.operators.linear . KTransformersLinear Injecting model.layers.60.self_attn.q_a_layernorm as default Injecting model.layers.60.self_attn.q_b_proj as ktransformers.operators.linear . KTransformersLinear Injecting model.layers.60.self_attn.kv_a_proj_with_mqa as ktransformers.operators.linear . KTransformersLinear Injecting model.layers.60.self_attn.kv_a_layernorm as default Injecting model.layers.60.self_attn.kv_b_proj as default Injecting model.layers.60.self_attn.o_proj as ktransformers.operators.linear . KTransformersLinear Injecting model.layers.60.self_attn.rotary_emb as ktransformers.operators.RoPE . YarnRotaryEmbeddingV3 Injecting model.layers.60.mlp as ktransformers.operators.experts . KDeepseekV3MoE Injecting model.layers.60.mlp.experts as ktransformers.operators.experts . KTransformersExperts Injecting model.layers.60.mlp.gate as ktransformers.operators.gate . KMoEGate Injecting model.layers.60.mlp.shared_experts as default Injecting model.layers.60.mlp.shared_experts.gate_proj as ktransformers.operators.linear . KTransformersLinear Injecting model.layers.60.mlp.shared_experts.up_proj as ktransformers.operators.linear . KTransformersLinear Injecting model.layers.60.mlp.shared_experts.down_proj as ktransformers.operators.linear . KTransformersLinear Injecting model.layers.60.mlp.shared_experts.act_fn as default Injecting model.layers.60.input_layernorm as default Injecting model.layers.60.post_attention_layernorm as default Injecting model.norm as default Injecting lm_head as ktransformers.operators.linear . KTransformersLinear Traceback (most recent call last): File "/workspace/ktransformers/./ktransformers/local_chat.py", line 183, in <module> fire.Fire(local_chat) File "/opt/conda/lib/python3.10/site-packages/fire/core.py", line 135, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "/opt/conda/lib/python3.10/site-packages/fire/core.py", line 468, in _Fire component, remaining_args = _CallAndUpdateTrace( File "/opt/conda/lib/python3.10/site-packages/fire/core.py", line 684, in _CallAndUpdateTrace component = fn(*varargs, **kwargs) File "/workspace/ktransformers/./ktransformers/local_chat.py", line 110, in local_chat optimize_and_load_gguf(model, optimize_config_path, gguf_path, config) File "/workspace/ktransformers/./ktransformers/optimize/optimize.py", line 130, in optimize_and_load_gguf load_weights(module.lm_head, gguf_loader, "lm_head.") File "/workspace/ktransformers/./ktransformers/util/utils.py", line 111, in load_weights module.load() File "/workspace/ktransformers/./ktransformers/operators/linear.py", line 522, in load self.generate_linear.load(w=w) File "/workspace/ktransformers/./ktransformers/operators/linear.py", line 279, in load w = self.load_weight(device=device) File "/workspace/ktransformers/./ktransformers/operators/linear.py", line 97, in load_weight tensors = self.load_multi(key, ["weight"], device=device) File "/workspace/ktransformers/./ktransformers/operators/linear.py", line 107, in load_multi tensors[k] = self.gguf_loader.load_gguf_tensor(key + "." + k, device=device) File "/workspace/ktransformers/./ktransformers/util/custom_gguf.py", line 376, in load_gguf_tensor values[blocks_begin : blocks_end] = cur_values RuntimeError: CUDA error: no kernel image is available for execution on the device Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions. bash: syntax error near unexpected token `newline'` I have already ensured that my cuda and pytorch installations allright. Could someone please help me resolve this issue? Any suggestions or solutions would be greatly appreciated.
bsakaguchi 2026-10-29 14:41:05 +00:00
  • closed this issue
  • added the
    stale
    label
Author
Owner

@Liskarm commented on GitHub (Mar 1, 2025):

The operating system version I am using is Ubuntu 22.04 LTS

<!-- gh-comment-id:2692301288 --> @Liskarm commented on GitHub (Mar 1, 2025): The operating system version I am using is Ubuntu 22.04 LTS
Author
Owner

@qiyuxinlin commented on GitHub (Mar 2, 2025):

Can you see your currently available GPU devices via torch?

<!-- gh-comment-id:2692576311 --> @qiyuxinlin commented on GitHub (Mar 2, 2025): Can you see your currently available GPU devices via torch?
Author
Owner

@Liskarm commented on GitHub (Mar 4, 2025):

Can you see your currently available GPU devices via torch?

yes,i will include the results I have reviewed below.

>>> print(torch.cuda.is_available())
True
>>> print(torch.cuda.device_count())
2
>>> print(torch.cuda.current_device())
0
>>> print(torch.cuda.get_device_name(0))
Tesla P100-PCIE-16GB
>>> print(torch.cuda.get_device_capability(0))
(6, 0)
>>>
<!-- gh-comment-id:2696370558 --> @Liskarm commented on GitHub (Mar 4, 2025): > Can you see your currently available GPU devices via torch? yes,i will include the results I have reviewed below. ``` >>> print(torch.cuda.is_available()) True >>> print(torch.cuda.device_count()) 2 >>> print(torch.cuda.current_device()) 0 >>> print(torch.cuda.get_device_name(0)) Tesla P100-PCIE-16GB >>> print(torch.cuda.get_device_capability(0)) (6, 0) >>> ```
Author
Owner

@qiyuxinlin commented on GitHub (Mar 4, 2025):

@Atream

<!-- gh-comment-id:2696655540 --> @qiyuxinlin commented on GitHub (Mar 4, 2025): @Atream
Author
Owner

@ErvinXie commented on GitHub (Dec 11, 2025):

This issue has been automatically closed due to inactivity for 60 days.

If you believe this issue is still relevant, please feel free to reopen it with additional information or context.

Thank you for your contribution to KTransformers!


此 issue 因超过 60 天无活动而被自动关闭。

如果您认为此问题仍然存在,请随时重新打开并提供更多信息或上下文。

感谢您对 KTransformers 的贡献!

<!-- gh-comment-id:3639969936 --> @ErvinXie commented on GitHub (Dec 11, 2025): This issue has been automatically closed due to inactivity for 60 days. If you believe this issue is still relevant, please feel free to reopen it with additional information or context. Thank you for your contribution to KTransformers! --- 此 issue 因超过 60 天无活动而被自动关闭。 如果您认为此问题仍然存在,请随时重新打开并提供更多信息或上下文。 感谢您对 KTransformers 的贡献!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/ktransformers#549
No description provided.