Skip to content

Commit edb58bb

Browse files
committed
fix: auto-detect GPU for GGUF backend (Device.AUTO uses n_gpu=-1)
1 parent 67ba285 commit edb58bb

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

qwen3_embed/text/gguf_embedding.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ def __init__(
114114

115115
from llama_cpp import Llama
116116

117-
n_gpu = -1 if (cuda is True or cuda == Device.CUDA) else 0
117+
# AUTO/-1: offload all layers to GPU if available, fallback to CPU
118+
# CPU/False/0: force CPU only
119+
n_gpu = 0 if (cuda is False or cuda == Device.CPU) else -1
118120
self._llm = Llama(
119121
model_path=str(model_path),
120122
embedding=True,

0 commit comments

Comments
 (0)