From f79db7059a4ed2852e6c19a2d8ac6f4f9c64a331 Mon Sep 17 00:00:00 2001 From: henk717 Date: Sat, 22 Jan 2022 23:21:19 +0100 Subject: [PATCH] Fall back to old json load Turns out model_config does not work on models that have no model_type defined. In case this happens we now fall back to the old .json loading method. This will not work in --colab mode if its not already a local model, but since almost all modern models define a model type and to my knowledge all models on huggingface do that should not be an issue. If it is we can always ask the model creator to either update it, distribute the model differently or load that model with --remote instead of --colab. --- aiserver.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/aiserver.py b/aiserver.py index 0d32a014..948bbca4 100644 --- a/aiserver.py +++ b/aiserver.py @@ -2267,8 +2267,12 @@ def loadsettings(): # Allow the models to override some settings #==================================================================# def loadmodelsettings(): - model_js_config = str(model_config).partition(' ')[2] - js = json.loads(model_js_config) + try: + model_js_config = str(model_config).partition(' ')[2] + js = json.loads(model_js_config) + except Exception as e: + model_js_config = open(vars.custmodpth.replace('/', '_') + "/config.json", "r") + js = json.load(model_js_config) if("badwordsids" in js): vars.badwordsids = js["badwordsids"] if("temp" in js):