From 08b4e317ff229b7c9dba739df62a6436a20d5153 Mon Sep 17 00:00:00 2001 From: somebody Date: Sat, 15 Apr 2023 13:30:05 -0500 Subject: [PATCH] Fix double slashing --- aiserver.py | 9 +++++---- modeling/inference_models/api.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/aiserver.py b/aiserver.py index 2d6acb13..2530555d 100644 --- a/aiserver.py +++ b/aiserver.py @@ -1911,12 +1911,16 @@ def load_model(use_gpu=True, gpu_layers=None, disk_layers=None, initial_load=Fal if koboldai_vars.model == "ReadOnly" or koboldai_vars.noai: print(":P") elif koboldai_vars.model in ["Colab", "API", "CLUSTER", "OAI"]: + koboldai_vars.colaburl = url or koboldai_vars.colaburl + koboldai_vars.usegpu = False + koboldai_vars.breakmodel = False + if koboldai_vars.model == "Colab": from modeling.inference_models.basic_api import BasicAPIInferenceModel model = BasicAPIInferenceModel() elif koboldai_vars.model == "API": from modeling.inference_models.api import APIInferenceModel - model = APIInferenceModel(url.replace("/request", "")) + model = APIInferenceModel(koboldai_vars.colaburl.replace("/request", "")) elif koboldai_vars.model == "CLUSTER": from modeling.inference_models.horde import HordeInferenceModel model = HordeInferenceModel() @@ -1924,9 +1928,6 @@ def load_model(use_gpu=True, gpu_layers=None, disk_layers=None, initial_load=Fal from modeling.inference_models.openai import OpenAIAPIInferenceModel model = OpenAIAPIInferenceModel() - koboldai_vars.colaburl = url or koboldai_vars.colaburl - koboldai_vars.usegpu = False - koboldai_vars.breakmodel = False model.load(initial_load=initial_load) # TODO: This check sucks, make a model object or somethign elif "rwkv" in koboldai_vars.model: diff --git a/modeling/inference_models/api.py b/modeling/inference_models/api.py index 3b045daf..d25505b0 100644 --- a/modeling/inference_models/api.py +++ b/modeling/inference_models/api.py @@ -25,7 +25,7 @@ class APIException(Exception): class APIInferenceModel(InferenceModel): def __init__(self, base_url: str) -> None: super().__init__() - self.base_url = base_url + self.base_url = base_url.rstrip("/") def _load(self, save_model: bool, initial_load: bool) -> None: tokenizer_id = requests.get(f"{self.base_url}/api/v1/model").json()["result"]