diff --git a/colab.ipynb b/colab.ipynb
index b5dd91640..d56deac47 100644
--- a/colab.ipynb
+++ b/colab.ipynb
@@ -53,6 +53,7 @@
"ContextSize = 4096 #@param [4096,8192] {allow-input: true}\n",
"FlashAttention = True #@param {type:\"boolean\"}\n",
"Multiplayer = False #@param {type:\"boolean\"}\n",
+ "DeleteExistingModels = False #@param {type:\"boolean\"}\n",
"FACommand = \"\"\n",
"MPCommand = \"\"\n",
"#@markdown
\n",
@@ -84,7 +85,7 @@
"#@markdown Only select the following box if regular cloudflare tunnel fails to work. It will generate an inferior localtunnel tunnel, which you can use after entering a password.\n",
"MakeLocalTunnelFallback = False #@param {type:\"boolean\"}\n",
"\n",
- "import os\n",
+ "import os, glob\n",
"if not os.path.isfile(\"/opt/bin/nvidia-smi\"):\n",
" raise RuntimeError(\"⚠️Colab did not give you a GPU due to usage limits, this can take a few hours before they let you back in. Check out https://lite.koboldai.net for a free alternative (that does not provide an API link but can load KoboldAI saves and chat cards) or subscribe to Colab Pro for immediate access.⚠️\")\n",
"\n",
@@ -113,23 +114,23 @@
"\n",
"%cd /content\n",
"if Mmproj and LoadVisionMMProjector:\n",
- " VCommand = \"--mmproj vmodel.gguf\"\n",
+ " VCommand = f\"--mmproj {Mmproj}\"\n",
"else:\n",
" SCommand = \"\"\n",
"if ImgModel and LoadImgModel:\n",
- " SCommand = \"--sdmodel imodel.gguf --sdthreads 4 --sdquant --sdclamped\"\n",
+ " SCommand = f\"--sdmodel {ImgModel} --sdthreads 4 --sdquant --sdclamped\"\n",
"else:\n",
" SCommand = \"\"\n",
"if SpeechModel and LoadSpeechModel:\n",
- " WCommand = \"--whispermodel wmodel.bin\"\n",
+ " WCommand = f\"--whispermodel {SpeechModel}\"\n",
"else:\n",
" WCommand = \"\"\n",
"if TTSModel and WavTokModel and LoadTTSModel:\n",
- " TTSCommand = \"--ttsmodel ttsmodel.bin --ttswavtokenizer ttswavtok.bin --ttsgpu\"\n",
+ " TTSCommand = f\"--ttsmodel {TTSModel} --ttswavtokenizer {WavTokModel} --ttsgpu\"\n",
"else:\n",
" TTSCommand = \"\"\n",
"if EmbeddingsModel and LoadEmbeddingsModel:\n",
- " ECommand = \"--embeddingsmodel emodel.bin\"\n",
+ " ECommand = f\"--embeddingsmodel {EmbeddingsModel}\"\n",
"else:\n",
" ECommand = \"\"\n",
"if FlashAttention:\n",
@@ -141,27 +142,26 @@
"else:\n",
" MPCommand = \"\"\n",
"\n",
+ "ModelCommand = f\"--model {Model}\"\n",
+ "\n",
+ "if DeleteExistingModels:\n",
+ " print(\"Deleting all cached models to redownload...\")\n",
+ " patterns = ['*.gguf', '*.bin']\n",
+ " for pattern in patterns:\n",
+ " for file_path in glob.glob(pattern):\n",
+ " try:\n",
+ " os.remove(file_path)\n",
+ " print(f\"Deleted: {file_path}\")\n",
+ " except Exception as e:\n",
+ " print(f\"Failed to delete {file_path}: {e}\")\n",
+ "\n",
+ "\n",
"!echo Downloading KoboldCpp, please wait...\n",
"!wget -O dlfile.tmp https://kcpplinux.concedo.workers.dev && mv dlfile.tmp koboldcpp_linux\n",
"!test -f koboldcpp_linux && echo Download Successful || echo Download Failed\n",
"!chmod +x ./koboldcpp_linux\n",
"!apt update\n",
"!apt install aria2 -y\n",
- "# simple fix for a common URL mistake\n",
- "if \"https://huggingface.co/\" in Model and \"/blob/main/\" in Model:\n",
- " Model = Model.replace(\"/blob/main/\", \"/resolve/main/\")\n",
- "!aria2c -x 10 -o model.gguf --summary-interval=5 --download-result=default --allow-overwrite=true --file-allocation=none $Model\n",
- "if VCommand:\n",
- " !aria2c -x 10 -o vmodel.gguf --summary-interval=5 --download-result=default --allow-overwrite=true --file-allocation=none $Mmproj\n",
- "if SCommand:\n",
- " !aria2c -x 10 -o imodel.gguf --summary-interval=5 --download-result=default --allow-overwrite=true --file-allocation=none $ImgModel\n",
- "if WCommand:\n",
- " !aria2c -x 10 -o wmodel.bin --summary-interval=5 --download-result=default --allow-overwrite=true --file-allocation=none $SpeechModel\n",
- "if TTSCommand:\n",
- " !aria2c -x 10 -o ttsmodel.bin --summary-interval=5 --download-result=default --allow-overwrite=true --file-allocation=none $TTSModel\n",
- " !aria2c -x 10 -o ttswavtok.bin --summary-interval=5 --download-result=default --allow-overwrite=true --file-allocation=none $WavTokModel\n",
- "if ECommand:\n",
- " !aria2c -x 10 -o emodel.bin --summary-interval=5 --download-result=default --allow-overwrite=true --file-allocation=none $EmbeddingsModel\n",
"\n",
"if MakeLocalTunnelFallback:\n",
" import urllib\n",
@@ -175,7 +175,7 @@
" print(f\"Please open the above link, and input the password '{ltpw}'\\nYour KoboldCpp will start shortly...\")\n",
" print(\"=================\")\n",
" !sleep 10\n",
- "!./koboldcpp_linux model.gguf --usecublas 0 mmq --chatcompletionsadapter AutoGuess --multiuser --gpulayers $Layers --contextsize $ContextSize --websearch --quiet --remotetunnel $FACommand $MPCommand $VCommand $SCommand $WCommand $TTSCommand $ECommand $SavGdriveCommand\n"
+ "!./koboldcpp_linux $ModelCommand --usecublas 0 mmq --chatcompletionsadapter AutoGuess --multiuser --gpulayers $Layers --contextsize $ContextSize --websearch --quiet --remotetunnel $FACommand $MPCommand $VCommand $SCommand $WCommand $TTSCommand $ECommand $SavGdriveCommand\n"
]
}
],