mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-13 10:29:43 +00:00
Updated Colab to use internal downloader
fixed model command (+1 squashed commits) Squashed commits: [a4d8fd9f1] tryout new colab (+1 squashed commits) Squashed commits: [c97333d44] tryout new colab
This commit is contained in:
parent
f3bb947a13
commit
2142d6ba68
1 changed files with 22 additions and 22 deletions
44
colab.ipynb
44
colab.ipynb
|
@ -53,6 +53,7 @@
|
||||||
"ContextSize = 4096 #@param [4096,8192] {allow-input: true}\n",
|
"ContextSize = 4096 #@param [4096,8192] {allow-input: true}\n",
|
||||||
"FlashAttention = True #@param {type:\"boolean\"}\n",
|
"FlashAttention = True #@param {type:\"boolean\"}\n",
|
||||||
"Multiplayer = False #@param {type:\"boolean\"}\n",
|
"Multiplayer = False #@param {type:\"boolean\"}\n",
|
||||||
|
"DeleteExistingModels = False #@param {type:\"boolean\"}\n",
|
||||||
"FACommand = \"\"\n",
|
"FACommand = \"\"\n",
|
||||||
"MPCommand = \"\"\n",
|
"MPCommand = \"\"\n",
|
||||||
"#@markdown <hr>\n",
|
"#@markdown <hr>\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",
|
"#@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",
|
"MakeLocalTunnelFallback = False #@param {type:\"boolean\"}\n",
|
||||||
"\n",
|
"\n",
|
||||||
"import os\n",
|
"import os, glob\n",
|
||||||
"if not os.path.isfile(\"/opt/bin/nvidia-smi\"):\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",
|
" 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",
|
"\n",
|
||||||
|
@ -113,23 +114,23 @@
|
||||||
"\n",
|
"\n",
|
||||||
"%cd /content\n",
|
"%cd /content\n",
|
||||||
"if Mmproj and LoadVisionMMProjector:\n",
|
"if Mmproj and LoadVisionMMProjector:\n",
|
||||||
" VCommand = \"--mmproj vmodel.gguf\"\n",
|
" VCommand = f\"--mmproj {Mmproj}\"\n",
|
||||||
"else:\n",
|
"else:\n",
|
||||||
" SCommand = \"\"\n",
|
" SCommand = \"\"\n",
|
||||||
"if ImgModel and LoadImgModel:\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",
|
"else:\n",
|
||||||
" SCommand = \"\"\n",
|
" SCommand = \"\"\n",
|
||||||
"if SpeechModel and LoadSpeechModel:\n",
|
"if SpeechModel and LoadSpeechModel:\n",
|
||||||
" WCommand = \"--whispermodel wmodel.bin\"\n",
|
" WCommand = f\"--whispermodel {SpeechModel}\"\n",
|
||||||
"else:\n",
|
"else:\n",
|
||||||
" WCommand = \"\"\n",
|
" WCommand = \"\"\n",
|
||||||
"if TTSModel and WavTokModel and LoadTTSModel:\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",
|
"else:\n",
|
||||||
" TTSCommand = \"\"\n",
|
" TTSCommand = \"\"\n",
|
||||||
"if EmbeddingsModel and LoadEmbeddingsModel:\n",
|
"if EmbeddingsModel and LoadEmbeddingsModel:\n",
|
||||||
" ECommand = \"--embeddingsmodel emodel.bin\"\n",
|
" ECommand = f\"--embeddingsmodel {EmbeddingsModel}\"\n",
|
||||||
"else:\n",
|
"else:\n",
|
||||||
" ECommand = \"\"\n",
|
" ECommand = \"\"\n",
|
||||||
"if FlashAttention:\n",
|
"if FlashAttention:\n",
|
||||||
|
@ -141,27 +142,26 @@
|
||||||
"else:\n",
|
"else:\n",
|
||||||
" MPCommand = \"\"\n",
|
" MPCommand = \"\"\n",
|
||||||
"\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",
|
"!echo Downloading KoboldCpp, please wait...\n",
|
||||||
"!wget -O dlfile.tmp https://kcpplinux.concedo.workers.dev && mv dlfile.tmp koboldcpp_linux\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",
|
"!test -f koboldcpp_linux && echo Download Successful || echo Download Failed\n",
|
||||||
"!chmod +x ./koboldcpp_linux\n",
|
"!chmod +x ./koboldcpp_linux\n",
|
||||||
"!apt update\n",
|
"!apt update\n",
|
||||||
"!apt install aria2 -y\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",
|
"\n",
|
||||||
"if MakeLocalTunnelFallback:\n",
|
"if MakeLocalTunnelFallback:\n",
|
||||||
" import urllib\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(f\"Please open the above link, and input the password '{ltpw}'\\nYour KoboldCpp will start shortly...\")\n",
|
||||||
" print(\"=================\")\n",
|
" print(\"=================\")\n",
|
||||||
" !sleep 10\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"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue