From cf8439e9e33e7ac94802a25cfa007d72e96b9f45 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Wed, 21 Sep 2022 23:37:20 -0600 Subject: [PATCH] Add files via upload --- sd-concepts-library Exporter.ipynb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sd-concepts-library Exporter.ipynb b/sd-concepts-library Exporter.ipynb index 85fcbb1..170684e 100644 --- a/sd-concepts-library Exporter.ipynb +++ b/sd-concepts-library Exporter.ipynb @@ -21,10 +21,12 @@ "outputs": [], "source": [ "# Install\n", - "!pip install huggingface-hub wget\n", + "%cd /notebooks/\n", + "!pip install huggingface-hub\n", "!apt update\n", "!apt install -y git-lfs\n", - "!mkdir -p /notebooks/sd-concepts-library" + "!mkdir -p /notebooks/sd-concepts-library\n", + "!mkdir -p /notebooks/sd-concepts-library/repositories" ] }, { @@ -38,9 +40,6 @@ "outputs": [], "source": [ "%cd /notebooks/sd-concepts-library\n", - "import requests\n", - "import os\n", - "import wget\n", "from huggingface_hub import HfApi\n", "\n", "api = HfApi()\n", @@ -50,8 +49,10 @@ "i = 1\n", "for model_info in models_list:\n", " print(f'\\nCloning {model_info.modelId} | {i}/{len(models_list)}')\n", - " url = f'https://huggingface.co/{model_info.modelId}'\n", - " !git clone $url\n", + " model_name = model_info.modelId.replace('sd-concepts-library/', '')\n", + " !git clone --depth=1 https://huggingface.co/{model_info.modelId} /notebooks/sd-concepts-library/repositories/{model_name}\n", + " !rm -rf /notebooks/sd-concepts-library/repositories/{model_name}/.git*\n", + " !mv /notebooks/sd-concepts-library/repositories/{model_name}/learned_embeds.bin /notebooks/sd-concepts-library/\"{model_name}.pt\"\n", " i = i + 1" ] },