瀏覽代碼

only set `main_gpu` if value > 0 is provided

Jeffrey Morgan 1 年之前
父節點
當前提交
a3fcecf943
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      llm/llama.go

+ 4 - 1
llm/llama.go

@@ -339,11 +339,14 @@ func newLlama(model string, adapters []string, runners []ModelRunner, numLayers
 		"--model", model,
 		"--ctx-size", fmt.Sprintf("%d", opts.NumCtx),
 		"--batch-size", fmt.Sprintf("%d", opts.NumBatch),
-		"--main-gpu", fmt.Sprintf("%d", opts.MainGPU),
 		"--n-gpu-layers", fmt.Sprintf("%d", numGPU),
 		"--embedding",
 	}
 
+	if opts.MainGPU > 0 {
+		params = append(params, "--main-gpu", fmt.Sprintf("%d", opts.MainGPU))
+	}
+
 	if opts.RopeFrequencyBase > 0 {
 		params = append(params, "--rope-freq-base", fmt.Sprintf("%f", opts.RopeFrequencyBase))
 	}