diff --git a/colab.ipynb b/colab.ipynb index 4960bad68..c0831919f 100644 --- a/colab.ipynb +++ b/colab.ipynb @@ -72,11 +72,37 @@ "TTSModel = \"https://huggingface.co/koboldcpp/tts/resolve/main/OuteTTS-0.2-500M-Q4_0.gguf\" #@param [\"https://huggingface.co/koboldcpp/tts/resolve/main/OuteTTS-0.2-500M-Q4_0.gguf\"]{allow-input: true}\n", "WavTokModel = \"https://huggingface.co/koboldcpp/tts/resolve/main/WavTokenizer-Large-75-Q4_0.gguf\" #@param [\"https://huggingface.co/koboldcpp/tts/resolve/main/WavTokenizer-Large-75-Q4_0.gguf\"]{allow-input: true}\n", "TTSCommand = \"\"\n", + "#@markdown
\n", + "AllowSaveToGoogleDrive = False #@param {type:\"boolean\"}\n", + "SavGdriveCommand = \"\"\n", "\n", "import os\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", + "if AllowSaveToGoogleDrive:\n", + " print(\"Attempting to request access to save to your google drive...\")\n", + " try:\n", + " from google.colab import drive\n", + " import os, json\n", + " drive.mount('/content/drive', force_remount=True)\n", + " if not os.path.exists(\"/content/drive/MyDrive\"):\n", + " raise RuntimeError(\"Google Drive mount failed. Please grant permissions and try again.\")\n", + " kcppdir = '/content/drive/MyDrive/koboldcpp_data'\n", + " os.makedirs(kcppdir, exist_ok=True)\n", + " savedatapath = os.path.join(kcppdir, \"koboldcpp_save_db.jsondb\")\n", + " if not os.path.exists(savedatapath):\n", + " settings_data = {}\n", + " with open(savedatapath, \"w\") as json_file:\n", + " json.dump(settings_data, json_file, indent=4)\n", + " print(f\"Created new koboldcpp_save_db.jsondb at {savedatapath}\")\n", + " else:\n", + " print(f\"Loading saved data at {savedatapath}\")\n", + " SavGdriveCommand = f\" --savedatafile {savedatapath}\"\n", + " except Exception as e:\n", + " print(f\"⚠️ Error: {e}\")\n", + " print(\"Please ensure you grant Google Drive permissions and try again.\")\n", + "\n", "%cd /content\n", "if Mmproj and LoadVisionMMProjector:\n", " VCommand = \"--mmproj vmodel.gguf\"\n", @@ -122,7 +148,7 @@ "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", - "!./koboldcpp_linux model.gguf --usecublas 0 mmq --chatcompletionsadapter AutoGuess --multiuser --gpulayers $Layers --contextsize $ContextSize --websearch --quiet --remotetunnel $FACommand $MPCommand $VCommand $SCommand $WCommand $TTSCommand\n" + "!./koboldcpp_linux model.gguf --usecublas 0 mmq --chatcompletionsadapter AutoGuess --multiuser --gpulayers $Layers --contextsize $ContextSize --websearch --quiet --remotetunnel $FACommand $MPCommand $VCommand $SCommand $WCommand $TTSCommand $SavGdriveCommand\n" ] } ],