Skip to content

Commit

Permalink
API: Fix merge overwrite
Browse files Browse the repository at this point in the history
The completions utils did not take the new imports.

Signed-off-by: kingbri <bdashore3@proton.me>
  • Loading branch information
bdashore3 committed Sep 5, 2024
1 parent ec7f64d commit 2f45e97
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions endpoints/OAI/utils/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@

from loguru import logger

from common import config, model
from common import model
from common.auth import get_key_permission
from common.networking import (
get_generator_error,
handle_request_disconnect,
handle_request_error,
request_disconnect_loop,
)
from common.tabby_config import config
from common.utils import unwrap
from endpoints.OAI.types.completion import (
CompletionRequest,
Expand Down Expand Up @@ -115,8 +116,6 @@ async def load_inline_model(model_name: str, request: Request):
if model.container and model.container.model_dir.name == model_name:
return

model_config = config.model_config()

# Inline model loading isn't enabled or the user isn't an admin
if not get_key_permission(request) == "admin":
error_message = handle_request_error(
Expand All @@ -127,15 +126,15 @@ async def load_inline_model(model_name: str, request: Request):

raise HTTPException(401, error_message)

if not unwrap(model_config.get("inline_model_loading"), False):
if not unwrap(config.model.get("inline_model_loading"), False):
logger.warning(
f"Unable to switch model to {model_name} because "
'"inline_model_load" is not True in config.yml.'
)

return

model_path = pathlib.Path(unwrap(model_config.get("model_dir"), "models"))
model_path = pathlib.Path(unwrap(config.model.get("model_dir"), "models"))
model_path = model_path / model_name

# Model path doesn't exist
Expand Down

0 comments on commit 2f45e97

Please sign in to comment.