Skip to content

Commit 02595f9

Browse files
authored
Colabcpp improvements (ggml-org#512)
* Aria2 * Aria2 Typo fix * Streamlined Wget * Streamlining Fix * Back to .so downloading * Crash colab if no GPU is present * Created using Colaboratory * Restore proper link Colab overwrite the link, manually changing it back so people don't land on my branch. * Restore file juggle * Fixing the colab link... again
1 parent 5e5be71 commit 02595f9

File tree

1 file changed

+42
-31
lines changed

1 file changed

+42
-31
lines changed

colab.ipynb

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,37 @@
33
{
44
"cell_type": "markdown",
55
"metadata": {
6-
"colab_type": "text",
7-
"id": "view-in-github"
6+
"id": "view-in-github",
7+
"colab_type": "text"
88
},
99
"source": [
1010
"<a href=\"https://colab.research.google.com/github/LostRuins/koboldcpp/blob/concedo/colab.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
1111
]
1212
},
1313
{
1414
"cell_type": "markdown",
15-
"metadata": {},
15+
"metadata": {
16+
"id": "2FCn5tmpn3UV"
17+
},
1618
"source": [
17-
"## Welcome to the Official KoboldCpp Colab Notebook\r\n",
18-
"It's really easy to get started. Just press the two **Play** buttons below, and then connect to the **Cloudflare URL** shown at the end. \r\n",
19-
"You can select a model from the dropdown, or enter a **custom URL** to a GGUF model (Example: `https://huggingface.co/KoboldAI/LLaMA2-13B-Tiefighter-GGUF/resolve/main/LLaMA2-13B-Tiefighter.Q4_K_M.gguf`)"
19+
"## Welcome to the Official KoboldCpp Colab Notebook\n",
20+
"It's really easy to get started. Just press the two **Play** buttons below, and then connect to the **Cloudflare URL** shown at the end.\n",
21+
"You can select a model from the dropdown, or enter a **custom URL** to a GGUF model (Example: `https://huggingface.co/KoboldAI/LLaMA2-13B-Tiefighter-GGUF/resolve/main/LLaMA2-13B-Tiefighter.Q4_K_M.gguf`)\n",
22+
"\n",
23+
"**Keep this page open and occationally check for captcha's so that your AI is not shut down**"
2024
]
2125
},
2226
{
2327
"cell_type": "code",
2428
"execution_count": null,
25-
"metadata": {},
29+
"metadata": {
30+
"id": "QNaj3u0jn3UW"
31+
},
2632
"outputs": [],
2733
"source": [
28-
"#@title <-- Tap this if you play on Mobile { display-mode: \"form\" }\r\n",
29-
"%%html\r\n",
30-
"<b>Press play on the music player to keep the tab alive, then start KoboldCpp below</b><br/>\r\n",
34+
"#@title <-- Tap this if you play on Mobile { display-mode: \"form\" }\n",
35+
"%%html\n",
36+
"<b>Press play on the music player to keep the tab alive, then start KoboldCpp below</b><br/>\n",
3137
"<audio src=\"https://raw.githubusercontent.com/KoboldAI/KoboldAI-Client/main/colab/silence.m4a\" controls>"
3238
]
3339
},
@@ -40,35 +46,40 @@
4046
},
4147
"outputs": [],
4248
"source": [
43-
"#@title <b>v-- Enter your model below and then click this to start Koboldcpp</b>\r\n",
44-
"\r\n",
45-
"Model = \"https://huggingface.co/KoboldAI/LLaMA2-13B-Tiefighter-GGUF/resolve/main/LLaMA2-13B-Tiefighter.Q4_K_M.gguf\" #@param [\"https://huggingface.co/KoboldAI/LLaMA2-13B-Tiefighter-GGUF/resolve/main/LLaMA2-13B-Tiefighter.Q4_K_M.gguf\",\"https://huggingface.co/TheBloke/MythoMax-L2-13B-GGUF/resolve/main/mythomax-l2-13b.Q4_K_M.gguf\",\"https://huggingface.co/TheBloke/ReMM-SLERP-L2-13B-GGUF/resolve/main/remm-slerp-l2-13b.Q4_K_M.gguf\",\"https://huggingface.co/TheBloke/Xwin-LM-13B-v0.2-GGUF/resolve/main/xwin-lm-13b-v0.2.Q4_K_M.gguf\",\"https://huggingface.co/TheBloke/Stheno-L2-13B-GGUF/resolve/main/stheno-l2-13b.Q4_K_M.gguf\",\"https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GGUF/resolve/main/mistral-7b-instruct-v0.1.Q4_K_S.gguf\"]{allow-input: true}\r\n",
46-
"Layers = 43 #@param [43]{allow-input: true}\r\n",
47-
"ContextSize = 4096 #@param [4096] {allow-input: true}\r\n",
48-
"\r\n",
49-
"%cd /content\r\n",
50-
"!git clone https://github.com/LostRuins/koboldcpp\r\n",
51-
"%cd /content/koboldcpp\r\n",
52-
"kvers = !(cat koboldcpp.py | grep 'KcppVersion = ' | cut -d '\"' -f2)\r\n",
53-
"kvers = kvers[0]\r\n",
54-
"!echo Finding prebuilt binary for {kvers}\r\n",
55-
"!wget -O dlfile.tmp -c https://kcppcolab.concedo.workers.dev/?{kvers} && mv dlfile.tmp koboldcpp_cublas.so\r\n",
56-
"!test -f koboldcpp_cublas.so && echo Prebuilt Binary Exists || echo Prebuilt Binary Does Not Exist\r\n",
57-
"!test -f koboldcpp_cublas.so && echo Build Skipped || make koboldcpp_cublas LLAMA_CUBLAS=1\r\n",
58-
"!cp koboldcpp_cublas.so koboldcpp_cublas.dat\r\n",
59-
"!wget $Model -O model.ggml\r\n",
60-
"!python koboldcpp.py model.ggml --usecublas 0 mmq --multiuser --gpulayers $Layers --contextsize $ContextSize --hordeconfig concedo 1 1 --remotetunnel\r\n"
49+
"#@title <b>v-- Enter your model below and then click this to start Koboldcpp</b>\n",
50+
"\n",
51+
"Model = \"https://huggingface.co/KoboldAI/LLaMA2-13B-Tiefighter-GGUF/resolve/main/LLaMA2-13B-Tiefighter.Q4_K_M.gguf\" #@param [\"https://huggingface.co/KoboldAI/LLaMA2-13B-Tiefighter-GGUF/resolve/main/LLaMA2-13B-Tiefighter.Q4_K_M.gguf\",\"https://huggingface.co/TheBloke/MythoMax-L2-13B-GGUF/resolve/main/mythomax-l2-13b.Q4_K_M.gguf\",\"https://huggingface.co/TheBloke/ReMM-SLERP-L2-13B-GGUF/resolve/main/remm-slerp-l2-13b.Q4_K_M.gguf\",\"https://huggingface.co/TheBloke/Xwin-LM-13B-v0.2-GGUF/resolve/main/xwin-lm-13b-v0.2.Q4_K_M.gguf\",\"https://huggingface.co/TheBloke/Stheno-L2-13B-GGUF/resolve/main/stheno-l2-13b.Q4_K_M.gguf\",\"https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GGUF/resolve/main/mistral-7b-instruct-v0.1.Q4_K_S.gguf\"]{allow-input: true}\n",
52+
"Layers = 43 #@param [43]{allow-input: true}\n",
53+
"ContextSize = 4096 #@param [4096] {allow-input: true}\n",
54+
"\n",
55+
"import os\n",
56+
"if not os.path.isfile(\"/opt/bin/nvidia-smi\"):\n",
57+
" 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",
58+
"\n",
59+
"%cd /content\n",
60+
"!git clone https://github.com/LostRuins/koboldcpp\n",
61+
"%cd /content/koboldcpp\n",
62+
"kvers = !(cat koboldcpp.py | grep 'KcppVersion = ' | cut -d '\"' -f2)\n",
63+
"kvers = kvers[0]\n",
64+
"!echo Finding prebuilt binary for {kvers}\n",
65+
"!wget -O dlfile.tmp -c https://kcppcolab.concedo.workers.dev/?{kvers} && mv dlfile.tmp koboldcpp_cublas.so\n",
66+
"!test -f koboldcpp_cublas.so && echo Prebuilt Binary Exists || echo Prebuilt Binary Does Not Exist\n",
67+
"!test -f koboldcpp_cublas.so && echo Build Skipped || make koboldcpp_cublas LLAMA_CUBLAS=1\n",
68+
"!cp koboldcpp_cublas.so koboldcpp_cublas.dat\n",
69+
"!apt install aria2 -y\n",
70+
"!aria2c -x 10 -o model.ggml --allow-overwrite=true --file-allocation=none $Model\n",
71+
"!python koboldcpp.py model.ggml --usecublas 0 mmq --multiuser --gpulayers $Layers --contextsize $ContextSize --hordeconfig concedo 1 1 --remotetunnel\n"
6172
]
6273
}
6374
],
6475
"metadata": {
6576
"accelerator": "GPU",
6677
"colab": {
67-
"authorship_tag": "",
6878
"gpuType": "T4",
69-
"include_colab_link": true,
7079
"private_outputs": true,
71-
"provenance": []
80+
"provenance": [],
81+
"cell_execution_strategy": "setup",
82+
"include_colab_link": true
7283
},
7384
"kernelspec": {
7485
"display_name": "Python 3",

0 commit comments

Comments
 (0)