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" ] },