From c55d1503ee2058aa7a63515dcfb02e86f8b5d131 Mon Sep 17 00:00:00 2001 From: henk717 Date: Fri, 19 Aug 2022 17:23:11 +0200 Subject: [PATCH 1/2] Skein 20B --- colab/TPU.ipynb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/colab/TPU.ipynb b/colab/TPU.ipynb index 448880e7..22c35e08 100644 --- a/colab/TPU.ipynb +++ b/colab/TPU.ipynb @@ -66,7 +66,7 @@ "#@title <-- Select your model below and then click this to start KoboldAI\n", "#@markdown You can find a description of the models below along with instructions on how to start KoboldAI.\n", "\n", - "Model = \"Nerys 13B V2\" #@param [\"Nerys 13B V2\", \"Janeway 13B\", \"Shinen 13B\", \"Skein 6B\", \"Janeway 6B\", \"Adventure 6B\", \"Shinen 6B\", \"Lit 6B\", \"NeoX 20B\", \"OPT 13B\", \"Fairseq Dense 13B\", \"GPT-J-6B\"] {allow-input: true}\n", + "Model = \"Nerys 13B V2\" #@param [\"Nerys 13B V2\", \"Janeway 13B\", \"Shinen 13B\", \"Skein 20B\", \"Skein 6B\", \"Janeway 6B\", \"Adventure 6B\", \"Shinen 6B\", \"Lit 6B\", \"NeoX 20B\", \"OPT 13B\", \"Fairseq Dense 13B\", \"GPT-J-6B\"] {allow-input: true}\n", "Version = \"Official\" #@param [\"Official\", \"United\"] {allow-input: true}\n", "Provider = \"Cloudflare\" #@param [\"Localtunnel\", \"Cloudflare\"]\n", "\n", @@ -93,6 +93,10 @@ " Model = \"KoboldAI/fairseq-dense-13B-Shinen\"\n", " path = \"\"\n", " download = \"\"\n", + "elif Model == \"Skein 20B\":\n", + " Model = \"KoboldAI/GPT-NeoX-20B-Skein\"\n", + " path = \"\"\n", + " download = \"\"\n", "elif Model == \"NeoX 20B\":\n", " Model = \"EleutherAI/gpt-neox-20b\"\n", " path = \"\"\n", @@ -128,7 +132,7 @@ "elif Model == \"GPT-J-6B\":\n", " Model = \"EleutherAI/gpt-j-6B\"\n", " path = \"\"\n", - " download = \"\"\n", + " download = \"\"\n", "else:\n", " path = \"\"\n", " download = \"\"\n", @@ -225,4 +229,4 @@ }, "nbformat": 4, "nbformat_minor": 0 -} +} \ No newline at end of file From 55f45c49127d43a3cfffb13010f969cddbc0e664 Mon Sep 17 00:00:00 2001 From: vfbd Date: Mon, 22 Aug 2022 14:45:02 -0400 Subject: [PATCH 2/2] Fix the model selection GUI when there is no internet connection --- aiserver.py | 20 ++++++++++---------- utils.py | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/aiserver.py b/aiserver.py index ef785313..642ced7d 100644 --- a/aiserver.py +++ b/aiserver.py @@ -1474,22 +1474,22 @@ def get_model_info(model, directory=""): def get_layer_count(model, directory=""): if(model not in ["InferKit", "Colab", "API", "OAI", "GooseAI" , "ReadOnly", "TPUMeshTransformerGPTJ"]): - if(vars.model == "GPT2Custom"): - model_config = open(vars.custmodpth + "/config.json", "r") + if(model == "GPT2Custom"): + with open(os.path.join(directory, "config.json"), "r") as f: + model_config = json.load(f) # Get the model_type from the config or assume a model type if it isn't present else: + if(directory): + model = directory from transformers import AutoConfig - if directory == "": - model_config = AutoConfig.from_pretrained(model, revision=vars.revision, cache_dir="cache") + if(os.path.isdir(model.replace('/', '_'))): + model_config = AutoConfig.from_pretrained(model.replace('/', '_'), revision=vars.revision, cache_dir="cache") + elif(os.path.isdir("models/{}".format(model.replace('/', '_')))): + model_config = AutoConfig.from_pretrained("models/{}".format(model.replace('/', '_')), revision=vars.revision, cache_dir="cache") elif(os.path.isdir(directory)): model_config = AutoConfig.from_pretrained(directory, revision=vars.revision, cache_dir="cache") - elif(os.path.isdir(vars.custmodpth.replace('/', '_'))): - model_config = AutoConfig.from_pretrained(vars.custmodpth.replace('/', '_'), revision=vars.revision, cache_dir="cache") else: - model_config = AutoConfig.from_pretrained(vars.custmodpth, revision=vars.revision, cache_dir="cache") - - - + model_config = AutoConfig.from_pretrained(model, revision=vars.revision, cache_dir="cache") return utils.num_layers(model_config) else: return None diff --git a/utils.py b/utils.py index 7fd82072..44c1129a 100644 --- a/utils.py +++ b/utils.py @@ -167,7 +167,7 @@ def decodenewlines(txt): # Returns number of layers given an HF model config #==================================================================# def num_layers(config): - return config.num_layers if hasattr(config, "num_layers") else config.n_layer if hasattr(config, "n_layer") else config.num_hidden_layers if hasattr(config, 'num_hidden_layers') else None + return config["n_layer"] if isinstance(config, dict) else config.num_layers if hasattr(config, "num_layers") else config.n_layer if hasattr(config, "n_layer") else config.num_hidden_layers if hasattr(config, 'num_hidden_layers') else None #==================================================================# # Downloads huggingface checkpoints using aria2c if possible