Skip to content

Commit bd6697d

Browse files
committed
remove key requirement for gguf models
1 parent ad9dc2e commit bd6697d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

skllm/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ def set_gguf_max_gpu_layers(n_layers: int):
190190
"""Sets the maximum number of layers to use for the GGUF model."""
191191
if not isinstance(n_layers, int):
192192
raise ValueError("n_layers must be an integer")
193+
if n_layers < -1:
194+
n_layers = -1
193195
os.environ[_GGUF_MAX_GPU_LAYERS] = str(n_layers)
194196

195197
@staticmethod

skllm/llm/gpt/mixin.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ def _get_openai_key(self) -> str:
8181
key = self.key
8282
if key is None:
8383
key = _Config.get_openai_key()
84+
if (
85+
hasattr(self, "model")
86+
and isinstance(self.model, str)
87+
and self.model.startswith("gguf::")
88+
):
89+
key = "gguf"
8490
if key is None:
8591
raise RuntimeError("OpenAI key was not found")
8692
return key

0 commit comments

Comments
 (0)