Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hrefhref/f14f6fb48771d8824072437c82e179c7 to your computer and use it in GitHub Desktop.
Save hrefhref/f14f6fb48771d8824072437c82e179c7 to your computer and use it in GitHub Desktop.
DownloadStableDiffusionToGDrive_v1.4.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "DownloadStableDiffusionToGDrive_v1.4.ipynb",
"provenance": [],
"collapsed_sections": [],
"authorship_tag": "ABX9TyM5ahTqMNFbrnhLFr9p5z3a",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/hrefhref/f14f6fb48771d8824072437c82e179c7/downloadstablediffusiontogdrive_v1-4.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"source": [
"# Download and save Stable Diffusion v1.4 to GDrive 🎉"
],
"metadata": {
"id": "zyPIu1mVGauk"
}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "XrfXONAPGUJx"
},
"outputs": [],
"source": [
"from getpass import getpass\n",
"from google.colab import drive\n",
"import os\n",
"import torch\n",
"\n",
"print(f\"Mounting GDrive...\")\n",
"drive.mount('/content/gdrive')\n",
"\n",
"print(f\"Be sure to accept the terms and conditions on https://huggingface.co/CompVis/stable-diffusion-v-1-4-original before downloading.\")\n",
"print(f\"Enter your HuggingFace username ad token. Get one at https://huggingface.co/settings/tokens\")\n",
"huggingface_username = getpass('Enter your HuggingFace Username: ')\n",
"huggingface_token = getpass('Enter your HuggingFace Token: ')\n",
"\n",
"outputs_path = \"/content/gdrive/MyDrive/AI/models\"\n",
"!mkdir -p $outputs_path\n",
"print(f\"Saving to {outputs_path}/sd-v1-4.ckpt\")\n",
"\n",
"print(f\"Downloading model....\")\n",
"!git lfs install\n",
"!GIT_LFS_SKIP_SMUDGE=0\n",
"!git clone https://$huggingface_username:$huggingface_token@huggingface.co/CompVis/stable-diffusion-v-1-4-original\n",
"\n",
"print(f\"Copying to GDrive...\")\n",
"!cp stable-diffusion-v-1-4-original/sd-v1-4.ckpt $outputs_path\n",
"\n",
"print(f\"Finished. \\o/\")"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment