Delete sd-concepts-library Exporter.ipynb

Former-commit-id: 9633bd4982305e52bc351192df615e551750d720 [formerly 1868daf6e1]
Former-commit-id: 9f1519d78d4090f7b07c111627ac1d152adaa7c4
This commit is contained in:
Cyberes 2022-09-21 23:37:39 -06:00 committed by GitHub
parent 1fea3f7c4a
commit 98a6319045
1 changed files with 0 additions and 108 deletions

View File

@ -1,108 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "269953b9-0933-4acc-b3b9-f6637d55008d",
"metadata": {},
"source": [
"# `sd-concepts-library` Exporter\n",
"\n",
"Download every Stable Diffusion textual inversion model from `sd-concepts-library`."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d83832f8-2ed8-470b-826e-164befb0753c",
"metadata": {
"scrolled": true,
"tags": []
},
"outputs": [],
"source": [
"# Install\n",
"%cd /notebooks/\n",
"!pip install huggingface-hub\n",
"!apt update\n",
"!apt install -y git-lfs\n",
"!mkdir -p /notebooks/sd-concepts-library\n",
"!mkdir -p /notebooks/sd-concepts-library/repositories"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f6dbd2aa-56ec-4ac8-987e-848afe017a68",
"metadata": {
"scrolled": true,
"tags": []
},
"outputs": [],
"source": [
"%cd /notebooks/sd-concepts-library\n",
"from huggingface_hub import HfApi\n",
"\n",
"api = HfApi()\n",
"models_list = api.list_models(author=\"sd-concepts-library\", sort=\"likes\", direction=-1)\n",
"print('Downloading', len(models_list), 'models...')\n",
"\n",
"i = 1\n",
"for model_info in models_list:\n",
" print(f'\\nCloning {model_info.modelId} | {i}/{len(models_list)}')\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"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8ad2bafd-dcad-4012-a6e4-ee298715019f",
"metadata": {},
"outputs": [],
"source": [
"!apt update\n",
"!apt install -y p7zip-full\n",
"from datetime import datetime\n",
"import os\n",
"datetime_str = datetime.now().strftime('%m-%d-%Y_%H:%M:%S')\n",
"%cd /notebooks/\n",
"print('Compressing, please wait...')\n",
"os.system(f'7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on sd-concepts-library_{datetime_str}.7z sd-concepts-library/')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cb7bdb05-8a84-4184-8d4c-31404a554d53",
"metadata": {},
"outputs": [],
"source": [
"!rm -rf /notebooks/sd-concepts-library"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}