├── .gitattributes ├── .gitignore ├── Jupyter.bat ├── LICENSE.md ├── README.md ├── Uninstall.bat ├── aiserver.py ├── breakmodel.py ├── bridge.lua ├── colab ├── GPU.ipynb ├── TPU.ipynb └── silence.m4a ├── colabkobold.sh ├── commandline-rocm.sh ├── commandline.bat ├── commandline.sh ├── cores └── default.lua ├── customsettings_template.json ├── disconnect-kobold-drive.bat ├── docker-cuda.sh ├── docker-cuda ├── Dockerfile └── docker-compose.yml ├── docker-rocm.sh ├── docker-rocm ├── Dockerfile └── docker-compose.yml ├── docker-standalone ├── Dockerfile ├── Readme.txt └── docker-helper.sh ├── environments ├── huggingface.yml └── rocm.yml ├── extern └── lualibs │ ├── base64.lua │ ├── hashings │ ├── adler32.lua │ ├── blake2b.lua │ ├── blake2s.lua │ ├── crc32.lua │ ├── hmac.lua │ ├── init.lua │ ├── keccak.lua │ ├── md5.lua │ ├── pbkdf2.lua │ ├── ripemd160.lua │ ├── sha1.lua │ ├── sha256.lua │ ├── sha3_256.lua │ ├── sha3_512.lua │ ├── sha512.lua │ └── whirlpool.lua │ ├── inspect.lua │ ├── json.lua │ ├── lpeg.lua │ ├── lulpeg.lua │ ├── moses.lua │ ├── mt19937ar.lua │ ├── nums │ ├── bn.lua │ ├── init.lua │ ├── uintb.lua │ └── uintn.lua │ ├── pegex.lua │ ├── pl │ ├── Date.lua │ ├── List.lua │ ├── Map.lua │ ├── MultiMap.lua │ ├── OrderedMap.lua │ ├── Set.lua │ ├── array2d.lua │ ├── class.lua │ ├── compat.lua │ ├── comprehension.lua │ ├── config.lua │ ├── data.lua │ ├── func.lua │ ├── import_into.lua │ ├── init.lua │ ├── input.lua │ ├── lapp.lua │ ├── lexer.lua │ ├── luabalanced.lua │ ├── operator.lua │ ├── permute.lua │ ├── pretty.lua │ ├── seq.lua │ ├── sip.lua │ ├── strict.lua │ ├── stringio.lua │ ├── stringx.lua │ ├── tablex.lua │ ├── template.lua │ ├── test.lua │ ├── text.lua │ ├── types.lua │ ├── url.lua │ ├── utils.lua │ └── xml.lua │ └── serpent.lua ├── fileops.py ├── gensettings.py ├── install_requirements.bat ├── install_requirements.sh ├── koboldai.ico ├── koboldaiblue.ico ├── koboldaigreen.ico ├── logger.py ├── maps ├── bloom.json ├── gpt_neo.json ├── gpt_neox.json ├── gptj.json ├── opt.json └── xglm.json ├── models └── models go here.txt ├── play-rocm.sh ├── play.bat ├── play.sh ├── prompt_tuner.py ├── pytest.ini ├── remote-play.bat ├── requirements.txt ├── requirements_mtj.txt ├── static ├── application.js ├── bootstrap-toggle.min.css ├── bootstrap-toggle.min.js ├── bootstrap.min.css ├── bootstrap.min.js ├── custom.css ├── favicon.js ├── jquery-3.6.0.min.js ├── jquery-ui.sortable.min.css ├── jquery-ui.sortable.min.js ├── open-iconic-bootstrap.min.css ├── open-iconic.woff ├── open-iconic │ ├── css │ │ ├── open-iconic-bootstrap.css │ │ ├── open-iconic-bootstrap.less │ │ ├── open-iconic-bootstrap.min.css │ │ ├── open-iconic-bootstrap.scss │ │ ├── open-iconic-bootstrap.styl │ │ ├── open-iconic-foundation.css │ │ ├── open-iconic-foundation.less │ │ ├── open-iconic-foundation.min.css │ │ ├── open-iconic-foundation.scss │ │ ├── open-iconic-foundation.styl │ │ ├── open-iconic.css │ │ ├── open-iconic.less │ │ ├── open-iconic.min.css │ │ ├── open-iconic.scss │ │ └── open-iconic.styl │ └── fonts │ │ ├── open-iconic.eot │ │ ├── open-iconic.otf │ │ ├── open-iconic.svg │ │ ├── open-iconic.ttf │ │ └── open-iconic.woff ├── rangy-core.min.js ├── socket.io.min.js ├── swagger-ui │ ├── LICENSE │ ├── SwaggerDark.css │ ├── index.css │ ├── oauth2-redirect.html │ ├── swagger-ui-bundle.js │ ├── swagger-ui.css │ └── swagger-ui.js └── thinking.gif ├── stories └── sample_story.json ├── structures.py ├── templates ├── index.html └── swagger-ui.html ├── test_aiserver.py ├── torch_lazy_loader.py ├── tpu_mtj_backend.py ├── umamba.exe ├── update-koboldai.bat ├── userscripts ├── Readme.txt ├── api_documentation.html ├── api_documentation.md ├── examples │ ├── Readme.txt │ ├── haxe_transcend.min.lua │ ├── haxe_transcend │ │ ├── KoboldLib.hx │ │ ├── Main.hx │ │ ├── README.md │ │ ├── build.bat │ │ ├── build.ps1 │ │ ├── build.sh │ │ └── min.js │ └── various_examples.lua ├── kaipreset_basic_phrase_bias.lua ├── kaipreset_location_scanner.lua ├── kaipreset_logits_viewer.lua ├── kaipreset_substitution.lua └── kaipreset_you_bias.lua ├── utils.py └── warpers.py /.gitattributes: -------------------------------------------------------------------------------- 1 | *.min.lua linguist-vendored 2 | *documentation.html linguist-vendored 3 | /static/swagger-ui/* linguist-vendored 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore client settings file 2 | settings 3 | 4 | # Ignore stories file except for test_story 5 | stories 6 | !stories/sample_story.json 7 | 8 | # Ignore stuff that would polute our Git 9 | /.project 10 | *.bak 11 | miniconda3 12 | runtime 13 | bin 14 | *.settings 15 | __pycache__ 16 | *.log 17 | cache 18 | accelerate-disk-cache 19 | userscripts 20 | !userscripts/examples 21 | !userscripts/kaipreset_*.lua 22 | !userscripts/Readme.* 23 | !userscripts/api_documentation.* 24 | softprompts 25 | models 26 | !models/models go here.txt 27 | Uninstall 28 | flask_session 29 | accelerate-disk-cache 30 | .ipynb_checkpoints 31 | 32 | # Ignore PyCharm project files. 33 | .idea 34 | 35 | # Ignore compiled Python files. 36 | *.pyc 37 | 38 | # Don't ignore defaults 39 | !defaults/* -------------------------------------------------------------------------------- /Jupyter.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | cd %~dp0 3 | TITLE Jupyter for KoboldAI Runtime 4 | SET /P M=nul 17 | umamba.exe install --no-shortcuts -r K:\python\ -n base -c conda-forge jupyterlab jupyterlab-git 18 | call K:\python\condabin\activate 19 | jupyter-lab 20 | subst K: /D 21 | cmd /k 22 | 23 | :drivemap_B 24 | subst B: miniconda3 >nul 25 | umamba.exe install --no-shortcuts -r B:\python\ -n base -c conda-forge jupyterlab jupyterlab-git 26 | call B:\python\condabin\activate 27 | jupyter-lab 28 | subst B: /D 29 | cmd /k -------------------------------------------------------------------------------- /Uninstall.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | cd /D %~dp0 3 | TITLE KoboldAI Uninstall Helper 4 | SET /P M=nul 6 | IF %M%==1 subst /D K: >nul 7 | 8 | IF "%1" == "FORCE" GOTO UNINSTALL 9 | 10 | IF EXIST "Uninstall\unins000.exe" ( 11 | start Uninstall\unins000.exe 12 | exit 13 | ) ELSE ( 14 | echo This will remove all KoboldAI folders that do not contain user data. 15 | echo DO NOT CONTINUE IF KOBOLDAI IS NOT IN ITS OWN FOLDER! OTHERWISE YOUR OTHER DATA IN THIS FOLDER WILL BE DELETED AS WELL! 16 | pause 17 | set /P D=Type DELETE if you wish to continue the uninstallation: 18 | ) 19 | 20 | IF %D%==DELETE GOTO UNINSTALL 21 | exit 22 | 23 | :UNINSTALL 24 | echo Uninstallation in progress, please wait... 25 | set DM=Y 26 | attrib -h .git >nul 27 | for /d %%D in (*) do if not "%%~nxD"=="stories" if not "%%~nxD"=="userscripts" if not "%%~nxD"=="settings" if not "%%~nxD"=="softprompts" if not "%%~nxD"=="models" if not "%%~nxD"=="Uninstall" rmdir /S /Q %%~nxD 28 | for %%i in (*) do if not "%%i"=="Uninstall.bat" del /q "%%i" 29 | set /P DM=Would you like to delete the models folder? (Y/n) : 30 | IF %DM%==Y rmdir models /s /q 31 | IF %DM%==y rmdir models /s /q 32 | set DM=N 33 | set /P DM=Would you like to delete all other user folders? (y/N) : 34 | IF %DM%==Y rmdir stories userscripts settings softprompts /s /q 35 | IF %DM%==y rmdir stories userscripts settings softprompts /s /q 36 | del Uninstall.bat -------------------------------------------------------------------------------- /colab/GPU.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "id": "kX9y5koxa58q" 7 | }, 8 | "source": [ 9 | "# You have found the old KoboldAI GPU colab!\n", 10 | "Because the legacy KoboldAI is incompatible with the latest colab changes we currently do not offer this version on Google Colab until a time that the dependencies can be updated.\n", 11 | "\n", 12 | "Are you here because of a tutorial? Don't worry we have a much better option.\n", 13 | "\n", 14 | "# [Click here to open KoboldCpp's colab](https://koboldai.org/colabcpp)\n", 15 | "KoboldCpp is our modern program compatible with the majority of software requiring KoboldAI United, loads much faster and has better models available. You can be running up to 20B models at faster speeds than this colab used to be.\n", 16 | "\n", 17 | "The catch? You will need to make sure your model is a GGUF version of the model.\n", 18 | "Need help? Contact us on https://koboldai.org/discord" 19 | ] 20 | } 21 | ], 22 | "metadata": { 23 | "accelerator": "GPU", 24 | "colab": { 25 | "name": "ColabKobold GPU", 26 | "private_outputs": true, 27 | "provenance": [] 28 | }, 29 | "kernelspec": { 30 | "display_name": "Python 3", 31 | "name": "python3" 32 | }, 33 | "language_info": { 34 | "name": "python" 35 | } 36 | }, 37 | "nbformat": 4, 38 | "nbformat_minor": 0 39 | } -------------------------------------------------------------------------------- /colab/TPU.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "id": "view-in-github", 7 | "colab_type": "text" 8 | }, 9 | "source": [ 10 | "\"Open" 11 | ] 12 | }, 13 | { 14 | "cell_type": "markdown", 15 | "source": [ 16 | "# Welcome to KoboldAI on Google Colab, TPU Edition!\n", 17 | "KoboldAI used to have a very powerful TPU engine for the TPU colab allowing you to run models above 6B, we have since moved on to more viable GPU based solutions that work across all vendors rather than splitting our time maintaing a colab exclusive backend.\n", 18 | "\n", 19 | "If you were brought here by a (video) tutorial keep in mind the tutorial you are following is very out of date.\n", 20 | "\n", 21 | "We recommend that you switch to Koboldcpp, our most modern solution that runs fantastic on Google Colab's GPU's allowing a similar level of performance that you were using before on the TPU at a fraction of the loading times.\n", 22 | "\n", 23 | "# [Click here to go to the KoboldCpp Colab](https://koboldai.org/colabcpp)\n", 24 | "\n", 25 | "The model you wish to use not available in GGUF format? You can use our [GPU colab](https://koboldai.org/colab) and select the United version to load models up to 13B.\n", 26 | "\n", 27 | "Both versions are capable of using our API and will work as you expect from a KoboldAI product. If you are following a tutorial the rest of the instructions may apply to these newer versions of our products." 28 | ], 29 | "metadata": { 30 | "id": "zrLGxVCEaqZx" 31 | } 32 | } 33 | ], 34 | "metadata": { 35 | "colab": { 36 | "name": "ColabKobold TPU", 37 | "provenance": [], 38 | "private_outputs": true, 39 | "include_colab_link": true 40 | }, 41 | "kernelspec": { 42 | "display_name": "Python 3", 43 | "name": "python3" 44 | }, 45 | "language_info": { 46 | "name": "python" 47 | }, 48 | "accelerator": "TPU" 49 | }, 50 | "nbformat": 4, 51 | "nbformat_minor": 0 52 | } -------------------------------------------------------------------------------- /colab/silence.m4a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KoboldAI/KoboldAI-Client/1ce811c3f9f828ea80274640e866ca3189daf91f/colab/silence.m4a -------------------------------------------------------------------------------- /commandline-rocm.sh: -------------------------------------------------------------------------------- 1 | bin/micromamba run -r runtime -n koboldai-rocm bash 2 | -------------------------------------------------------------------------------- /commandline.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | cd /D %~dp0 3 | SET CONDA_SHLVL= 4 | 5 | TITLE CMD for KoboldAI Runtime 6 | SET /P M=nul 19 | SET TEMP=K:\ 20 | SET TMP=K:\ 21 | call K:\python\condabin\activate 22 | cmd /k "%*" 23 | 24 | :drivemap_B 25 | subst B: miniconda3 >nul 26 | SET TEMP=B:\ 27 | SET TMP=B:\ 28 | call B:\python\condabin\activate 29 | cmd /k "%*" -------------------------------------------------------------------------------- /commandline.sh: -------------------------------------------------------------------------------- 1 | bin/micromamba run -r runtime -n koboldai bash 2 | -------------------------------------------------------------------------------- /cores/default.lua: -------------------------------------------------------------------------------- 1 | -- Default core script 2 | -- Runs all generation modifiers and output modifiers in forward order, and 3 | -- runs all input modifiers in reverse order 4 | 5 | kobold, koboldcore = require("bridge")() -- This line is optional and is only for EmmyLua type annotations 6 | 7 | ---@class KoboldCoreScript 8 | local corescript = {} 9 | 10 | 11 | -- Run all the input modifiers from bottom to top 12 | function corescript.inmod() 13 | for i = #koboldcore.userscripts, 1, -1 do 14 | local userscript = koboldcore.userscripts[i] 15 | userscript.inmod() 16 | end 17 | end 18 | 19 | -- Run all the generation modifiers from top to bottom 20 | function corescript.genmod() 21 | for i, userscript in ipairs(koboldcore.userscripts) do 22 | userscript.genmod() 23 | end 24 | end 25 | 26 | -- Run all the generation modifiers from top to bottom 27 | function corescript.outmod() 28 | for i, userscript in ipairs(koboldcore.userscripts) do 29 | userscript.outmod() 30 | end 31 | end 32 | 33 | 34 | return corescript 35 | -------------------------------------------------------------------------------- /customsettings_template.json: -------------------------------------------------------------------------------- 1 | {"aria2_port":null, "breakmodel":null, "breakmodel_disklayers":null, "breakmodel_gpulayers":null, "breakmodel_layers":null, "colab":null, "configname":null, "cpu":null, "host":null, "localtunnel":null, "lowmem":null, "model":null, "ngrok":null, "no_aria2":null, "noaimenu":null, "nobreakmodel":null, "override_delete":null, "override_rename":null, "path":null, "port":null, "quiet":null, "remote":null, "revision":null, "savemodel":null, "unblock":null} 2 | -------------------------------------------------------------------------------- /disconnect-kobold-drive.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | SET /P M=