Skip to content

Commit

Permalink
BUG: llama_cpp model context length (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
UranusSeven authored Sep 6, 2023
1 parent 931aa6b commit 4ffc1b7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions xinference/model/llm/ggml/llamacpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import logging
import os
import platform
from typing import TYPE_CHECKING, Iterator, List, Optional, TypedDict, Union

from ....types import (
Expand Down Expand Up @@ -123,11 +122,9 @@ def _sanitize_model_config(
) -> LlamaCppModelConfig:
if llamacpp_model_config is None:
llamacpp_model_config = LlamaCppModelConfig()
if platform.system() == "Windows":
llamacpp_model_config.setdefault("n_ctx", 512)
else:
llamacpp_model_config.setdefault("n_ctx", 2048)

if self.model_family.context_length:
llamacpp_model_config.setdefault("n_ctx", self.model_family.context_length)
llamacpp_model_config.setdefault("embedding", True)
llamacpp_model_config.setdefault("use_mmap", False)
llamacpp_model_config.setdefault("use_mlock", True)
Expand Down

0 comments on commit 4ffc1b7

Please sign in to comment.