Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

Fix/4742 ollama num gpu option not consistent with allowed values (#4751)

crazywoola705a6e3a8e8a
diff --git a/api/core/model_runtime/model_providers/ollama/llm/llm.py b/api/core/model_runtime/model_providers/ollama/llm/llm.py
index 894195dcc15..2dfc4714330 100644
--- a/api/core/model_runtime/model_providers/ollama/llm/llm.py
+++ b/api/core/model_runtime/model_providers/ollama/llm/llm.py
@@ -534,12 +534,14 @@ class OllamaLargeLanguageModel(LargeLanguageModel):
),
ParameterRule(
name='num_gpu',
- label=I18nObject(en_US="Num GPU"),
+ label=I18nObject(en_US="GPU Layers"),
type=ParameterType.INT,
- help=I18nObject(en_US="The number of layers to send to the GPU(s). "
- "On macOS it defaults to 1 to enable metal support, 0 to disable."),
- min=0,
- max=1
+ help=I18nObject(en_US="The number of layers to offload to the GPU(s). "
+ "On macOS it defaults to 1 to enable metal support, 0 to disable."
+ "As long as a model fits into one gpu it stays in one. "
+ "It does not set the number of GPU(s). "),
+ min=-1,
+ default=1
),
ParameterRule(
name='num_thread',