From 73865ba0667aa0d1d53dbf7fef11996838743179 Mon Sep 17 00:00:00 2001 From: ebolam Date: Wed, 19 Oct 2022 11:05:17 -0400 Subject: [PATCH 1/2] Add parameter to Colab for not using google drive (data would be ephemeral) --- colab/GPU.ipynb | 8 +++++++- colab/TPU.ipynb | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/colab/GPU.ipynb b/colab/GPU.ipynb index ba171275..d8971127 100644 --- a/colab/GPU.ipynb +++ b/colab/GPU.ipynb @@ -70,10 +70,16 @@ "Model = \"Nerys 2.7B\" #@param [\"Nerys 2.7B\", \"AID 2.7B\", \"Erebus 2.7B\", \"Janeway 2.7B\", \"Picard 2.7B\", \"Horni LN 2.7B\", \"Horni 2.7B\", \"Shinen 2.7B\", \"OPT 2.7B\", \"Fairseq Dense 2.7B\", \"Neo 2.7B\"] {allow-input: true}\n", "Version = \"Official\" #@param [\"Official\", \"United\"] {allow-input: true}\n", "Provider = \"Localtunnel\" #@param [\"Localtunnel\", \"Cloudflare\"]\n", + "use_google_drive = True #@param {type:\"boolean\"}\n", "\n", "!nvidia-smi\n", "from google.colab import drive\n", - "drive.mount('/content/drive/')\n", + "if use_google_drive:\n", + " drive.mount('/content/drive/')\n", + "else:\n", + " import os\n", + " os.mkdir(\"/content/drive\")\n", + " os.mkdir(\"/content/drive/MyDrive/\")\n", "\n", "if Model == \"Nerys 2.7B\":\n", " Model = \"KoboldAI/fairseq-dense-2.7B-Nerys\"\n", diff --git a/colab/TPU.ipynb b/colab/TPU.ipynb index 6ec346fc..6e640e32 100644 --- a/colab/TPU.ipynb +++ b/colab/TPU.ipynb @@ -69,6 +69,7 @@ "Model = \"Nerys 13B V2\" #@param [\"Nerys 13B V2\", \"Erebus 13B\", \"Janeway 13B\", \"Shinen 13B\", \"Skein 20B\", \"Erebus 20B\", \"Skein 6B\", \"Janeway 6B\", \"Adventure 6B\", \"Shinen 6B\", \"Lit V2 6B\", \"Lit 6B\", \"NeoX 20B\", \"OPT 13B\", \"Fairseq Dense 13B\", \"GPT-J-6B\"] {allow-input: true}\n", "Version = \"Official\" #@param [\"Official\", \"United\"] {allow-input: true}\n", "Provider = \"Localtunnel\" #@param [\"Localtunnel\", \"Cloudflare\"]\n", + "use_google_drive = True #@param {type:\"boolean\"}\n", "\n", "import os\n", "try:\n", @@ -79,7 +80,12 @@ " raise RuntimeError(\"⚠️You can not run this notebook without the TPU accelerator, go to Runtime->Sessions, terminate your session and then try again.⚠️\")\n", "print('Now we will need your Google Drive to store settings and saves, you must login with the same account you used for Colab.')\n", "from google.colab import drive\n", - "drive.mount('/content/drive/')\n", + "if use_google_drive:\n", + " drive.mount('/content/drive/')\n", + "else:\n", + " import os\n", + " os.mkdir(\"/content/drive\")\n", + " os.mkdir(\"/content/drive/MyDrive/\")\n", "\n", "if Model == \"Janeway 13B\":\n", " Model = \"KoboldAI/fairseq-dense-13B-Janeway\"\n", From d588dc0096473240a839e2ade2a3da28b81d6062 Mon Sep 17 00:00:00 2001 From: ebolam Date: Wed, 19 Oct 2022 11:19:04 -0400 Subject: [PATCH 2/2] Check if dir exists before creating --- colab/GPU.ipynb | 6 ++++-- colab/TPU.ipynb | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/colab/GPU.ipynb b/colab/GPU.ipynb index d8971127..8c76b5ed 100644 --- a/colab/GPU.ipynb +++ b/colab/GPU.ipynb @@ -78,8 +78,10 @@ " drive.mount('/content/drive/')\n", "else:\n", " import os\n", - " os.mkdir(\"/content/drive\")\n", - " os.mkdir(\"/content/drive/MyDrive/\")\n", + " if not os.path.exists(\"/content/drive\"):\n", + " os.mkdir(\"/content/drive\")\n", + " if not os.path.exists(\"/content/drive/MyDrive/\"):\n", + " os.mkdir(\"/content/drive/MyDrive/\")\n", "\n", "if Model == \"Nerys 2.7B\":\n", " Model = \"KoboldAI/fairseq-dense-2.7B-Nerys\"\n", diff --git a/colab/TPU.ipynb b/colab/TPU.ipynb index 6e640e32..efdfa5c4 100644 --- a/colab/TPU.ipynb +++ b/colab/TPU.ipynb @@ -84,8 +84,10 @@ " drive.mount('/content/drive/')\n", "else:\n", " import os\n", - " os.mkdir(\"/content/drive\")\n", - " os.mkdir(\"/content/drive/MyDrive/\")\n", + " if not os.path.exists(\"/content/drive\"):\n", + " os.mkdir(\"/content/drive\")\n", + " if not os.path.exists(\"/content/drive/MyDrive/\"):\n", + " os.mkdir(\"/content/drive/MyDrive/\")\n", "\n", "if Model == \"Janeway 13B\":\n", " Model = \"KoboldAI/fairseq-dense-13B-Janeway\"\n",