Fix for multiple paths

This commit is contained in:
onesome
2023-04-26 16:49:12 -05:00
parent 6776a71532
commit d4f7b60dc9

View File

@@ -25,15 +25,22 @@ class HFInferenceModel(InferenceModel):
""" """
if self.model_name in ["NeoCustom", "GPT2Custom", "TPUMeshTransformerGPTJ", "TPUMeshTransformerGPTNeoX"]: if self.model_name in ["NeoCustom", "GPT2Custom", "TPUMeshTransformerGPTJ", "TPUMeshTransformerGPTNeoX"]:
assert utils.koboldai_vars.custmodpth model_path = utils.koboldai_vars.custmodpth
assert model_path
# Path can be absolute or relative to models directory
if os.path.exists(model_path):
return model_path
model_path = os.path.join("models", model_path)
try: try:
assert os.path.exists(utils.koboldai_vars.custmodpth) assert os.path.exists(model_path)
except AssertionError: except AssertionError:
logger.error(f"Custom model at '{utils.koboldai_vars.custmodpth}' doesn't seem to exist") logger.error(f"Custom model does not exist at '{utils.koboldai_vars.custmodpth}' or '{model_path}'.")
raise raise
return utils.koboldai_vars.custmodpth return model_path
basename = utils.koboldai_vars.model.replace("/", "_") basename = utils.koboldai_vars.model.replace("/", "_")
if legacy: if legacy: