API: Fix loading

This commit is contained in:
somebody
2023-07-19 11:52:39 -05:00
parent 5f2600d338
commit fef42a6273
4 changed files with 31 additions and 6 deletions

View File

@@ -15,8 +15,12 @@ class HFInferenceModel(InferenceModel):
def __init__(self) -> None:
super().__init__()
self.model_config = None
#self.model_name = model_name
# TODO: model_name should probably be an instantiation parameter all the
# way down the inheritance chain.
self.model_name = None
self.path = None
self.hf_torch = False
self.model = None
self.tokenizer = None
@@ -213,6 +217,11 @@ class HFInferenceModel(InferenceModel):
torch.cuda.empty_cache()
except:
pass
def _pre_load(self) -> None:
# HACK: Make model instantiation work without UI parameters
self.model_name = self.model_name or utils.koboldai_vars.model
return super()._pre_load()
def _post_load(self) -> None:
self.badwordsids = koboldai_settings.badwordsids_default