From d8e99b12f184f9c40c204f8328f1fb3612f5a6ef Mon Sep 17 00:00:00 2001 From: Gnome Ann <> Date: Mon, 28 Feb 2022 19:00:26 -0500 Subject: [PATCH 1/6] Re-enable the editor mutation observer --- static/application.js | 18 ++++++++++++++++++ templates/index.html | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/static/application.js b/static/application.js index 7e7352fb..2f380585 100644 --- a/static/application.js +++ b/static/application.js @@ -1628,6 +1628,21 @@ function highlightEditingChunks() { } } +// This gets run every time the text in a chunk is edited +// or a chunk is deleted +function chunkOnDOMMutate(mutations, observer) { + if(!gametext_bound || !allowedit) { + return; + } + var nodes = []; + for(var i = 0; i < mutations.length; i++) { + var mutation = mutations[i]; + nodes = nodes.concat(Array.from(mutation.addedNodes), Array.from(mutation.removedNodes)); + nodes.push(mutation.target); + } + applyChunkDeltas(nodes); +} + // This gets run every time you try to paste text into the editor function chunkOnPaste(event) { // Register the chunk we're pasting in as having been modified @@ -1705,10 +1720,12 @@ function chunkOnFocusOut(event) { } function bindGametext() { + mutation_observer.observe(game_text[0], {characterData: true, childList: true, subtree: true}); gametext_bound = true; } function unbindGametext() { + mutation_observer.disconnect(); gametext_bound = false; } @@ -2280,6 +2297,7 @@ $(document).ready(function(){ ).on('focusout', chunkOnFocusOut ); + mutation_observer = new MutationObserver(chunkOnDOMMutate); // This is required for the editor to work correctly in Firefox on desktop // because the gods of HTML and JavaScript say so diff --git a/templates/index.html b/templates/index.html index 192ed9fc..40812cee 100644 --- a/templates/index.html +++ b/templates/index.html @@ -17,7 +17,7 @@ - + From f9ac23ba4e50146104f02916cba4633cd84e2e98 Mon Sep 17 00:00:00 2001 From: henk717 Date: Wed, 2 Mar 2022 09:51:25 +0100 Subject: [PATCH 2/6] Add Janeway and Shinen --- .gitignore | 14 ++++++++------ aiserver.py | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 033958a9..d470fb4b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,26 @@ # Ignore client settings file -settings/* +settings # Ignore stories file except for test_story -stories/* +stories !stories/sample_story.json # Ignore stuff that would polute our Git /.project *.bak -miniconda3/* +miniconda3 *.settings __pycache__ *.log -cache/* -userscripts/* +cache +userscripts !userscripts/examples !userscripts/kaipreset_*.lua !userscripts/Readme.* !userscripts/api_documentation.* -softprompts/* +softprompts +models +!models/models go here.txt # Ignore PyCharm project files. .idea diff --git a/aiserver.py b/aiserver.py index b69eb4a1..be860287 100644 --- a/aiserver.py +++ b/aiserver.py @@ -69,8 +69,10 @@ modellist = [ ["Load a model from its directory", "NeoCustom", ""], ["Load an old GPT-2 model (eg CloverEdition)", "GPT2Custom", ""], ["Skein 6B (Hybrid)", "KoboldAI/GPT-J-6B-Skein", "16GB"], + ["Janeway 6B (Novel)", "KoboldAI/GPT-J-6B-Janeway", "16GB"], ["Adventure 6B", "KoboldAI/GPT-J-6B-Adventure", "16GB"], ["Lit 6B (NSFW)", "hakurei/lit-6B", "16GB"], + ["Shinen 6B (NSFW)", "KoboldAI/GPT-J-6B-Shinen", "16GB"], ["C1 6B (Chatbot)", "hakurei/c1-6B", "16GB"], ["Janeway 2.7B (Novel)", "KoboldAI/GPT-Neo-2.7B-Janeway", "8GB"], ["Adventure 2.7B", "KoboldAI/GPT-Neo-2.7B-AID", "8GB"], From 2aeb2c6607ae913e90e3e0638972227b4257db9f Mon Sep 17 00:00:00 2001 From: henk717 Date: Fri, 4 Mar 2022 09:53:34 +0100 Subject: [PATCH 3/6] Add Janeway 6B and Shinen 6B --- colab/TPU.ipynb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/colab/TPU.ipynb b/colab/TPU.ipynb index fc9bb323..334c1daf 100644 --- a/colab/TPU.ipynb +++ b/colab/TPU.ipynb @@ -48,7 +48,7 @@ "outputs": [], "source": [ "#@title <-- Click this to start KoboldAI\n", - "Model = \"Skein 6B\" #@param [\"Skein 6B\", \"Adventure 6B\", \"Lit 6B\", \"Generic 6B\", \"C1 6B\"]\n", + "Model = \"Skein 6B\" #@param [\"Skein 6B\", \"Janeway 6B\", \"Adventure 6B\", \"Lit 6B\", \"Shinen 6B\", \"Generic 6B\", \"C1 6B\"]\n", "Version = \"Official\" #@param [\"Official\", \"United\"] {allow-input: true}\n", "Drive = \"Unextracted (Less Space)\" #@param [\"Unextracted (Less Space)\", \"Extracted (Faster Loading)\"]\n", "#@markdown Extracted models take up more space but load faster the next time you use them, not all models use your Google Drive. See the Model list below for descriptions and space requirements. If your extracted model does not load the next time you try to launch KoboldAI delete the folder from your Google Drive and ensure enough space is available.\n", @@ -64,6 +64,13 @@ " extract = \"\"\n", " Drive = \"Unextracted (Less Space)\"\n", " ![[ -f /content/drive/MyDrive/KoboldAI/settings/gpt-j-6b-skein-jax.settings ]] || echo -e \"{\\n \\\"apikey\\\": \\\"\\\",\\n \\\"andepth\\\": 3,\\n \\\"temp\\\": 0.5,\\n \\\"top_p\\\": 0.9,\\n \\\"top_k\\\": 0,\\n \\\"tfs\\\": 1.0,\\n \\\"rep_pen\\\": 1.1,\\n \\\"genamt\\\": 80,\\n \\\"max_length\\\": 2048,\\n \\\"ikgen\\\": 200,\\n \\\"formatoptns\\\": {\\n \\\"frmttriminc\\\": true,\\n \\\"frmtrmblln\\\": false,\\n \\\"frmtrmspch\\\": false,\\n \\\"frmtadsnsp\\\": false\\n },\\n \\\"numseqs\\\": 1,\\n \\\"widepth\\\": 3,\\n \\\"useprompt\\\": true,\\n \\\"adventure\\\": false\\n}\" > /content/drive/MyDrive/KoboldAI/settings/gpt-j-6b-skein-jax.settings\n", + "if Model == \"Janeway 6B\":\n", + " path = \"gpt-j-6b-janeway-jax\"\n", + " location = \"colab\"\n", + " download = \"-a https://storage.henk.tech/KoboldAI/janeway-jax.txt\"\n", + " extract = \"\"\n", + " Drive = \"Unextracted (Less Space)\"\n", + " ![[ -f /content/drive/MyDrive/KoboldAI/settings/gpt-j-6b-janeway-jax.settings ]] || echo -e \"{\\n \\\"apikey\\\": \\\"\\\",\\n \\\"andepth\\\": 3,\\n \\\"temp\\\": 0.5,\\n \\\"top_p\\\": 0.9,\\n \\\"top_k\\\": 0,\\n \\\"tfs\\\": 1.0,\\n \\\"rep_pen\\\": 1.1,\\n \\\"rep_pen_slope\\\": 0.7,\\n \\\"rep_pen_range\\\": 1024.0,\\n \\\"genamt\\\": 80,\\n \\\"max_length\\\": 2048,\\n \\\"ikgen\\\": 200,\\n \\\"formatoptns\\\": {\\n \\\"frmttriminc\\\": true,\\n \\\"frmtrmblln\\\": false,\\n \\\"frmtrmspch\\\": false,\\n \\\"frmtadsnsp\\\": false,\\n \\\"singleline\\\": false\\n },\\n \\\"numseqs\\\": 1,\\n \\\"widepth\\\": 3,\\n \\\"useprompt\\\": true,\\n \\\"adventure\\\": false,\\n \\\"chatmode\\\": false,\\n \\\"chatname\\\": \\\"You\\\",\\n \\\"dynamicscan\\\": false,\\n \\\"nopromptgen\\\": false,\\n \\\"rngpersist\\\": false,\\n \\\"nogenmod\\\": false,\\n \\\"autosave\\\": false,\\n \\\"welcome\\\": false,\\n \\\"newlinemode\\\": \\\"n\\\",\\n \\\"antemplate\\\": \\\"[Genre: <|>]\\\",\\n \\\"userscripts\\\": [],\\n \\\"corescript\\\": \\\"default.lua\\\",\\n \\\"softprompt\\\": \\\"\\\"\\n}\" > /content/drive/MyDrive/KoboldAI/settings/gpt-j-6b-janeway-jax.settings\n", "if Model == \"Adventure 6B\":\n", " path = \"gpt-j-6b-adventure-jax\"\n", " location = \"colab\"\n", @@ -77,6 +84,13 @@ " download = \"-a https://storage.henk.tech/KoboldAI/aria2.php?file=gpt-j-6b-lit-jax.7z\"\n", " extract = \"-z gpt-j-6b-lit-jax.7z\"\n", " ![[ -f /content/drive/MyDrive/KoboldAI/settings/gpt-j-6b-lit-jax.settings ]] || echo -e \"{\\n \\\"apikey\\\": \\\"\\\",\\n \\\"andepth\\\": 3,\\n \\\"temp\\\": 0.5,\\n \\\"top_p\\\": 0.9,\\n \\\"top_k\\\": 0,\\n \\\"tfs\\\": 1.0,\\n \\\"rep_pen\\\": 1.1,\\n \\\"genamt\\\": 80,\\n \\\"max_length\\\": 2048,\\n \\\"ikgen\\\": 200,\\n \\\"formatoptns\\\": {\\n \\\"frmttriminc\\\": true,\\n \\\"frmtrmblln\\\": false,\\n \\\"frmtrmspch\\\": false,\\n \\\"frmtadsnsp\\\": false\\n },\\n \\\"numseqs\\\": 1,\\n \\\"widepth\\\": 3,\\n \\\"useprompt\\\": true,\\n \\\"adventure\\\": false\\n}\" > /content/drive/MyDrive/KoboldAI/settings/gpt-j-6b-lit-jax.settings\n", + "if Model == \"Shinen 6B\":\n", + " path = \"gpt-j-6b-shinen-jax\"\n", + " location = \"colab\"\n", + " download = \"-a https://storage.henk.tech/KoboldAI/shinen-jax.txt\"\n", + " extract = \"\"\n", + " Drive = \"Unextracted (Less Space)\"\n", + " ![[ -f /content/drive/MyDrive/KoboldAI/settings/gpt-j-6b-shinen-jax.settings ]] || echo -e \"{\\n \\\"apikey\\\": \\\"\\\",\\n \\\"andepth\\\": 3,\\n \\\"temp\\\": 0.5,\\n \\\"top_p\\\": 0.9,\\n \\\"top_k\\\": 0,\\n \\\"tfs\\\": 1.0,\\n \\\"rep_pen\\\": 1.1,\\n \\\"rep_pen_slope\\\": 0.7,\\n \\\"rep_pen_range\\\": 1024.0,\\n \\\"genamt\\\": 80,\\n \\\"max_length\\\": 2048,\\n \\\"ikgen\\\": 200,\\n \\\"formatoptns\\\": {\\n \\\"frmttriminc\\\": true,\\n \\\"frmtrmblln\\\": false,\\n \\\"frmtrmspch\\\": false,\\n \\\"frmtadsnsp\\\": false,\\n \\\"singleline\\\": false\\n },\\n \\\"numseqs\\\": 1,\\n \\\"widepth\\\": 3,\\n \\\"useprompt\\\": true,\\n \\\"adventure\\\": false,\\n \\\"chatmode\\\": false,\\n \\\"chatname\\\": \\\"You\\\",\\n \\\"dynamicscan\\\": false,\\n \\\"nopromptgen\\\": false,\\n \\\"rngpersist\\\": false,\\n \\\"nogenmod\\\": false,\\n \\\"autosave\\\": false,\\n \\\"welcome\\\": false,\\n \\\"newlinemode\\\": \\\"n\\\",\\n \\\"antemplate\\\": \\\"[Genre: <|>]\\\",\\n \\\"userscripts\\\": [],\\n \\\"corescript\\\": \\\"default.lua\\\",\\n \\\"softprompt\\\": \\\"\\\"\\n}\" > /content/drive/MyDrive/KoboldAI/settings/gpt-j-6b-shinen-jax.settings\n", "if Model == \"Generic 6B\":\n", " path = \"step_383500\"\n", " location = \"drive\"\n", From fade5fdd6012cd5ea326e72306d1d514a2e0c5bd Mon Sep 17 00:00:00 2001 From: henk717 Date: Fri, 4 Mar 2022 11:31:03 +0100 Subject: [PATCH 4/6] Update model descriptions (TPU) --- colab/TPU.ipynb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/colab/TPU.ipynb b/colab/TPU.ipynb index 334c1daf..916012b2 100644 --- a/colab/TPU.ipynb +++ b/colab/TPU.ipynb @@ -120,9 +120,11 @@ "\n", "| Model | Size | Style | Drive Space | Description |\n", "| ------------------------------ | ------ | --------- | ----------- | ------------------------------------------------------------ |\n", - "| Skein 6B by VE_FORBDRYDERNE | 6B TPU | Hybrid | 0 GB | Skein is our flagship 6B model, it is a hybrid between a Adventure model and a Novel model. Best used with either Adventure mode or the You Bias userscript enabled. Skein has been trained on high quality Novels along with CYOA adventure stories and is not as wackey as the Adventure model. It also has tagging support. |\n", + "| Skein 6B by VE_FORBRYDERNE | 6B TPU | Hybrid | 0 GB | Skein is our flagship 6B model, it is a hybrid between a Adventure model and a Novel model. Best used with either Adventure mode or the You Bias userscript enabled. Skein has been trained on high quality Novels along with CYOA adventure stories and is not as wackey as the Adventure model. It also has tagging support. |\n", + "| Janeway 6B by Mr Seeker | 6B TPU | Novel | 0 GB | Janeway is a model created from Picard's dataset combined with a brand new collection of ebooks. This model is trained on 20% more content than Picard and has been trained on literature from various genres. Although the model is mainly focussed on SFW, romantic scenes might involve a degree of nudity. |\n", "| Adventure 6B by VE_FORBRYDERNE | 6B TPU | Adventure | 0 GB | Adventure is a 6B model designed to mimick the behavior of AI Dungeon. It is exclusively for Adventure Mode and can take you on the epic and wackey adventures that AI Dungeon players love. It also features the many tropes of AI Dungeon as it has been trained on very similar data. It must be used in second person (You). |\n", "| Lit 6B by Haru | 6B TPU | NSFW | 8 GB / 12 GB | Lit is a great NSFW model trained by Haru on both a large set of Literotica stories and high quality novels along with tagging support. Creating a high quality model for your NSFW stories. This model is exclusively a novel model and is best used in third person. |\n", + "| Shinen 6B by Mr Seeker | 6B TPU | NSFW | 0 GB | Shinen is an alternative to the Lit model designed to be more explicit. If Lit is to tame for you Shinen might produce better results. While it is a Novel model it is unsuitable for SFW stories due to its heavy NSFW bias. Shinen will not hold back. It is meant to be used in KoboldAI's regular mode. |\n", "| Generic 6B by EleutherAI | 6B TPU | Generic | 10 GB / 12 GB | GPT-J-6B is what all other models are based on, if you need something that has no specific bias towards any particular subject this is the model for you. Best used when the other models are not suitable for what you wish to do. Such as homework assistance, blog writing, coding and more. It needs more hand holding than other models and is more prone to undesirable formatting changes. |\n", "| C1 6B by Haru | 6B TPU | Chatbot | 8 GB / 12 GB | C1 has been trained on various internet chatrooms, it makes the basis for an interesting chatbot model and has been optimized to be used in the Chatmode. |\n", "\n", @@ -131,6 +133,7 @@ "\n", "| Model | Size | Style | Description |\n", "| ------------------------------------------------------------ | -------- | ---------- | ------------------------------------------------------------ |\n", + "| [GPT-Neo-2.7B-Janeway](https://huggingface.co/KoboldAI/GPT-Neo-2.7B-Janeway) by Mr Seeker | 2.7B GPU | Novel | Janeway is a model created from Picard's dataset combined with a brand new collection of ebooks. This model is trained on 20% more content than Picard and has been trained on literature from various genres. Although the model is mainly focussed on SFW, romantic scenes might involve a degree of nudity. |\n", "| [GPT-Neo-2.7B-Picard](https://huggingface.co/KoboldAI/GPT-Neo-2.7B-Picard) by Mr Seeker | 2.7B GPU | Novel | Picard is a model trained for SFW Novels based on GPT-Neo-2.7B. It is focused on Novel style writing without the NSFW bias. While the name suggests a sci-fi model this model is designed for Novels of a variety of genre's. It is meant to be used in KoboldAI's regular mode. |\n", "| [GPT-Neo-2.7B-AID](https://huggingface.co/KoboldAI/GPT-Neo-2.7B-AID) by melastacho | 2.7B GPU | Adventure | Also know as Adventure 2.7B this is a clone of the AI Dungeon Classic model and is best known for the epic wackey adventures that AI Dungeon Classic players love. |\n", "| [GPT-Neo-2.7B-Horni-LN](https://huggingface.co/KoboldAI/GPT-Neo-2.7B-Horni-LN) by finetune | 2.7B GPU | Novel | This model is based on GPT-Neo-2.7B-Horni and retains its NSFW knowledge, but was then further biased towards SFW novel stories. If you seek a balance between a SFW Novel model and a NSFW model this model should be a good choice. |\n", From 749d4a1c485c9d35038b65d1af24ff17a93bc026 Mon Sep 17 00:00:00 2001 From: henk717 Date: Fri, 4 Mar 2022 11:33:05 +0100 Subject: [PATCH 5/6] Update Colab Descriptions (GPU) --- colab/GPU.ipynb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/colab/GPU.ipynb b/colab/GPU.ipynb index c112c6ff..47c31f27 100644 --- a/colab/GPU.ipynb +++ b/colab/GPU.ipynb @@ -7,7 +7,7 @@ "private_outputs": true, "provenance": [], "collapsed_sections": [], - "authorship_tag": "ABX9TyNIlnz2e5VPAZKiM4cuuzJK", + "authorship_tag": "ABX9TyOKIa/NDLlYI5j63GXPtkXv", "include_colab_link": true }, "kernelspec": { @@ -86,6 +86,7 @@ "# GPU Edition Model Descriptions\n", "| Model | Size | Style | Description |\n", "| ------------------------------------------------------------ | -------- | ---------- | ------------------------------------------------------------ |\n", + "| [GPT-Neo-2.7B-Janeway](https://huggingface.co/KoboldAI/GPT-Neo-2.7B-Janeway) by Mr Seeker | 2.7B GPU | Novel | Janeway is a model created from Picard's dataset combined with a brand new collection of ebooks. This model is trained on 20% more content than Picard and has been trained on literature from various genres. Although the model is mainly focussed on SFW, romantic scenes might involve a degree of nudity. |\n", "| [GPT-Neo-2.7B-Picard](https://huggingface.co/KoboldAI/GPT-Neo-2.7B-Picard) by Mr Seeker | 2.7B GPU | Novel | Picard is a model trained for SFW Novels based on GPT-Neo-2.7B. It is focused on Novel style writing without the NSFW bias. While the name suggests a sci-fi model this model is designed for Novels of a variety of genre's. It is meant to be used in KoboldAI's regular mode. |\n", "| [GPT-Neo-2.7B-AID](https://huggingface.co/KoboldAI/GPT-Neo-2.7B-AID) by melastacho | 2.7B GPU | Adventure | Also know as Adventure 2.7B this is a clone of the AI Dungeon Classic model and is best known for the epic wackey adventures that AI Dungeon Classic players love. |\n", "| [GPT-Neo-2.7B-Horni-LN](https://huggingface.co/KoboldAI/GPT-Neo-2.7B-Horni-LN) by finetune | 2.7B GPU | Novel | This model is based on GPT-Neo-2.7B-Horni and retains its NSFW knowledge, but was then further biased towards SFW novel stories. If you seek a balance between a SFW Novel model and a NSFW model this model should be a good choice. |\n", @@ -98,8 +99,10 @@ "| Model | Size | Style | Drive Space | Description |\n", "| ------------------------------ | ------ | --------- | ----------- | ------------------------------------------------------------ |\n", "| Skein 6B by VE_FORBDRYDERNE | 6B TPU | Hybrid | 0 GB | Skein is our flagship 6B model, it is a hybrid between a Adventure model and a Novel model. Best used with either Adventure mode or the You Bias userscript enabled. Skein has been trained on high quality Novels along with CYOA adventure stories and is not as wackey as the Adventure model. It also has tagging support. |\n", + "| Janeway 6B by Mr Seeker | 6B TPU | Novel | 0 GB | Janeway is a model created from Picard's dataset combined with a brand new collection of ebooks. This model is trained on 20% more content than Picard and has been trained on literature from various genres. Although the model is mainly focussed on SFW, romantic scenes might involve a degree of nudity. |\n", "| Adventure 6B by VE_FORBRYDERNE | 6B TPU | Adventure | 0 GB | Adventure is a 6B model designed to mimick the behavior of AI Dungeon. It is exclusively for Adventure Mode and can take you on the epic and wackey adventures that AI Dungeon players love. It also features the many tropes of AI Dungeon as it has been trained on very similar data. It must be used in second person (You). |\n", "| Lit 6B by Haru | 6B TPU | NSFW | 8 GB / 12 GB | Lit is a great NSFW model trained by Haru on both a large set of Literotica stories and high quality novels along with tagging support. Creating a high quality model for your NSFW stories. This model is exclusively a novel model and is best used in third person. |\n", + "| Shinen 6B by Mr Seeker | 6B TPU | NSFW | 0 GB | Shinen is an alternative to the Lit model designed to be more explicit. If Lit is to tame for you Shinen might produce better results. While it is a Novel model it is unsuitable for SFW stories due to its heavy NSFW bias. Shinen will not hold back. It is meant to be used in KoboldAI's regular mode. |\n", "| Generic 6B by EleutherAI | 6B TPU | Generic | 10 GB / 12 GB | GPT-J-6B is what all other models are based on, if you need something that has no specific bias towards any particular subject this is the model for you. Best used when the other models are not suitable for what you wish to do. Such as homework assistance, blog writing, coding and more. It needs more hand holding than other models and is more prone to undesirable formatting changes. |\n", "| C1 6B by Haru | 6B TPU | Chatbot | 8 GB / 12 GB | C1 has been trained on various internet chatrooms, it makes the basis for an interesting chatbot model and has been optimized to be used in the Chatmode. |\n", "\n", From ae143e896cc09563a37a4543740ca6da682690c0 Mon Sep 17 00:00:00 2001 From: MrReplikant <74075031+MrReplikant@users.noreply.github.com> Date: Fri, 4 Mar 2022 08:46:00 -0600 Subject: [PATCH 6/6] Fixed unnecessary spacing in chatmode This makes it go from "john :" to "John:", as it's supposed to be. As simple as it is, it can easily throw a chatbot model for a loop. --- aiserver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aiserver.py b/aiserver.py index be860287..c1652a9e 100644 --- a/aiserver.py +++ b/aiserver.py @@ -2402,7 +2402,7 @@ def actionsubmit(data, actionmode=0, force_submit=False, force_prompt_gen=False, if(vars.chatmode and vars.gamestarted): data = re.sub(r'\n+', ' ', data) if(len(data)): - data = f"\n{vars.chatname} : {data}\n" + data = f"\n{vars.chatname}: {data}\n" # mode if(vars.newlinemode == "s"):