{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import os\n", "from IPython.display import clear_output\n", "%cd /content\n", "# 克隆 InvokeAI 的 GitHub 仓库\n", "!git clone -b main https://github.com/Van-wise/IAekovnI\n", "# 安装所需的 Python 包\n", "!pip install -q dependency_injector diffusers einops eventlet facexlib flask_cors flask_socketio flaskwebgui getpass_asterisk huggingface-hub\n", "!pip install -q kornia omegaconf pudb pyreadline3 pytorch-lightning realesrgan streamlit taming-transformers-rom1504 test-tube torch-fidelity\n", "!pip install -q torchmetrics transformers picklescan\n", "!pip install -q pillow xformers==0.0.20 triton==2.0.0 -U\n", "clear_output()\n", "# 克隆预处理器的GitHub仓库\n", "!pip install -q git+https://github.com/invoke-ai/GFPGAN@basicsr-1.4.2#egg=gfpgan\n", "!pip install -q git+https://github.com/openai/CLIP.git@main#egg=clip\n", "!pip install -q git+https://github.com/Birch-san/k-diffusion.git@mps#egg=k-diffusion\n", "!pip install -q git+https://github.com/invoke-ai/clipseg.git@relaxed-python-requirement#egg=clipseg\n", "!pip install -q git+https://github.com/invoke-ai/PyPatchMatch@0.1.4#egg=pypatchmatch\n", "\n", "%cd /content/IAekovnI/\n", "!pip install -q -e .\n", "clear_output()\n", "print('依赖安装完成!')\n", "\n", "# 模型下载\n", "!wget https://huggingface.co/Vanwise/sd-colab/resolve/main/Invoke/INITIAL_MODELS.yaml -O /content/IAekovnI/invokeai/configs/INITIAL_MODELS.yaml\n", "!python /content/IAekovnI/scripts/invokeai-model-install.py --root_dir /content/IAekovnI/db --yes\n", "!curl -Lo /content/IAekovnI/db/models/sd-1/main/chilloutmix_NiPrunedFp32Fix-inpainting.inpainting.safetensors https://huggingface.co/spaces/weo1101/111/resolve/main/chilloutmix_NiPrunedFp32Fix-inpainting.inpainting.safetensors\n", "\n", "!wget https://huggingface.co/Vanwise/sd-colab/resolve/main/libtcmalloc_minimal.so.4\n", "os.environ['LD_PRELOAD'] = '/content/IAekovnI/libtcmalloc_minimal.so.4'\n", "\n", "!wget https://huggingface.co/Vanwise/sd-colab/resolve/main/Invoke/_start.ipynb\n", "\n", "clear_output()\n", "print('模型下载完成!')" ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 2 }