【深度学习 AIGC】stablediffusion-infinity 在无界限画布中输出绘画 Outpainting

代码:https://github.com/lkwq007/stablediffusion-infinity/tree/master

启动环境:

shell 复制代码
git clone --recurse-submodules https://github.com/lkwq007/stablediffusion-infinity
cd stablediffusion-infinity
conda env create -f environment.yml
conda activate sd-inf

# 一定更新一下!
conda install -c conda-forge diffusers transformers ftfy accelerate
conda update -c conda-forge diffusers transformers ftfy accelerate
pip install -U gradio

python app.py

修改了一下app.py的东西,最后面修改了ip和端口:

css 复制代码
launch_extra_kwargs = {
    "show_error": True,
    # "favicon_path": ""
}
launch_kwargs = vars(args)
launch_kwargs = {k: v for k, v in launch_kwargs.items() if v is not None}
print(launch_kwargs)
launch_kwargs.pop("remote_model", None)
launch_kwargs.pop("local_model", None)
launch_kwargs.pop("fp32", None)
launch_kwargs.pop("lowvram", None)
launch_kwargs.update(launch_extra_kwargs)
try:
    import google.colab

    launch_kwargs["debug"] = True
except:
    pass

if RUN_IN_SPACE:
    print("run in space")
    demo.launch()
elif args.debug:
    print(111111111)
    launch_kwargs["share"]=True
    launch_kwargs["server_name"] = "0.0.0.0"
    launch_kwargs["server_port"] = 8000
    demo.queue().launch(**launch_kwargs)
else:
    print(222222222)
    launch_kwargs["share"]=True
    launch_kwargs["server_name"] = "0.0.0.0"
    launch_kwargs["server_port"] = 8000
    demo.queue().launch(**launch_kwargs)

可以对照一下环境:

shell 复制代码
(sd-inf)   Thu Sep 14    20:59:37    /ssd/xiedong/stablediffusion-infinity  pip list
Package                       Version
----------------------------- ---------
absl-py                       1.3.0
accelerate                    0.22.0
aiofiles                      23.2.1
aiohttp                       3.8.1
aiosignal                     1.3.1
altair                        5.1.1
antlr4-python3-runtime        4.9.3
anyio                         3.6.2
async-timeout                 4.0.2
attrs                         23.1.0
backports.functools-lru-cache 1.6.4
bcrypt                        4.0.1
brotlipy                      0.7.0
cachetools                    5.2.0
certifi                       2023.7.22
cffi                          1.15.1
charset-normalizer            2.0.4
click                         8.1.3
cloudpickle                   2.0.0
cmake                         3.25.0
colorama                      0.4.6
commonmark                    0.9.1
contourpy                     1.0.6
cryptography                  38.0.1
cycler                        0.11.0
cytoolz                       0.12.0
dask                          2022.7.0
dataclasses                   0.8
datasets                      2.7.0
diffusers                     0.14.0
dill                          0.3.6
einops                        0.4.1
fastapi                       0.87.0
ffmpy                         0.3.0
filelock                      3.8.0
fonttools                     4.38.0
fpie                          0.2.4
frozenlist                    1.3.0
fsspec                        2022.10.0
ftfy                          6.1.1
google-auth                   2.14.1
google-auth-oauthlib          0.4.6
gradio                        3.44.2
gradio_client                 0.5.0
grpcio                        1.51.0
h11                           0.12.0
httpcore                      0.15.0
httpx                         0.23.1
huggingface-hub               0.17.1
idna                          3.4
imagecodecs                   2021.8.26
imageio                       2.19.3
importlib-metadata            5.0.0
importlib-resources           6.0.1
Jinja2                        3.1.2
joblib                        1.2.0
jsonschema                    4.19.0
jsonschema-specifications     2023.7.1
kiwisolver                    1.4.4
linkify-it-py                 1.0.3
llvmlite                      0.39.1
locket                        1.0.0
Markdown                      3.4.1
markdown-it-py                2.1.0
MarkupSafe                    2.1.1
matplotlib                    3.6.2
mdit-py-plugins               0.3.1
mdurl                         0.1.2
mkl-fft                       1.3.1
mkl-random                    1.2.2
mkl-service                   2.4.0
multidict                     6.0.2
multiprocess                  0.70.12.2
networkx                      2.8.4
numba                         0.56.4
numpy                         1.23.4
oauthlib                      3.2.2
omegaconf                     2.2.3
opencv-python                 4.6.0.66
opencv-python-headless        4.6.0.66
orjson                        3.8.2
packaging                     21.3
pandas                        1.4.2
paramiko                      2.12.0
partd                         1.2.0
Pillow                        9.2.0
pip                           22.2.2
protobuf                      3.20.3
psutil                        5.9.1
pyarrow                       8.0.0
pyasn1                        0.4.8
pyasn1-modules                0.2.8
pycparser                     2.21
pycryptodome                  3.15.0
pydantic                      1.10.2
pyDeprecate                   0.3.2
pydub                         0.25.1
Pygments                      2.13.0
PyNaCl                        1.5.0
pyOpenSSL                     22.0.0
pyparsing                     3.0.9
PySocks                       1.7.1
python-dateutil               2.8.2
python-multipart              0.0.5
pytorch-lightning             1.7.7
pytz                          2022.6
PyWavelets                    1.3.0
PyYAML                        6.0
referencing                   0.30.2
regex                         2022.4.24
requests                      2.28.1
requests-oauthlib             1.3.1
responses                     0.18.0
rfc3986                       1.5.0
rich                          12.6.0
rpds-py                       0.10.3
rsa                           4.9
sacremoses                    0.0.53
safetensors                   0.3.2
scikit-image                  0.19.2
scipy                         1.9.3
semantic-version              2.10.0
setuptools                    65.5.0
six                           1.16.0
sniffio                       1.3.0
sourceinspect                 0.0.4
starlette                     0.21.0
taichi                        1.2.2
tensorboard                   2.11.0
tensorboard-data-server       0.6.1
tensorboard-plugin-wit        1.8.1
tifffile                      2021.7.2
timm                          0.6.11
tokenizers                    0.11.4
toolz                         0.12.0
torch                         1.13.0
torchaudio                    0.13.0
torchmetrics                  0.10.3
torchvision                   0.14.0
tqdm                          4.64.1
transformers                  4.33.1
typing_extensions             4.3.0
uc-micro-py                   1.0.1
urllib3                       1.26.12
uvicorn                       0.20.0
wcwidth                       0.2.5
websockets                    10.4
Werkzeug                      2.2.2
wheel                         0.37.1
xxhash                        0.0.0
yarl                          1.7.2
zipp                          3.10.0

路径下建立一个stabilityai,然后下载stable-diffusion-2-inpainting放进去,sd-vae-ft-mse是stable-diffusion-2-inpainting/vae里的东西复制了一遍。

shell 复制代码
(sd-inf)   Thu Sep 14    21:00:31    /ssd/xiedong/stablediffusion-infinity  tree stabilityai/
stabilityai/
├── sd-vae-ft-mse
│   ├── config.json
│   ├── diffusion_pytorch_model.bin
│   ├── diffusion_pytorch_model.fp16.bin
│   ├── diffusion_pytorch_model.fp16.safetensors
│   └── diffusion_pytorch_model.safetensors
└── stable-diffusion-2-inpainting
    ├── 512-inpainting-ema.ckpt
    ├── 512-inpainting-ema.safetensors
    ├── feature_extractor
    │   └── preprocessor_config.json
    ├── merged-leopards.png
    ├── model_index.json
    ├── README.md
    ├── scheduler
    │   └── scheduler_config.json
    ├── sd-vae-ft-mse-original
    │   ├── README.md
    │   ├── vae-ft-mse-840000-ema-pruned.ckpt
    │   └── vae-ft-mse-840000-ema-pruned.safetensors
    ├── text_encoder
    │   ├── config.json
    │   ├── model.fp16.safetensors
    │   ├── model.safetensors
    │   ├── pytorch_model.bin
    │   └── pytorch_model.fp16.bin
    ├── tokenizer
    │   ├── merges.txt
    │   ├── special_tokens_map.json
    │   ├── tokenizer_config.json
    │   └── vocab.json
    ├── unet
    │   ├── config.json
    │   ├── diffusion_pytorch_model.bin
    │   ├── diffusion_pytorch_model.fp16.bin
    │   ├── diffusion_pytorch_model.fp16.safetensors
    │   └── diffusion_pytorch_model.safetensors
    └── vae
        ├── config.json
        ├── diffusion_pytorch_model.bin
        ├── diffusion_pytorch_model.fp16.bin
        ├── diffusion_pytorch_model.fp16.safetensors
        └── diffusion_pytorch_model.safetensors

然后就可以用了:



相关推荐
qq_529025295 分钟前
Torch.gather
python·深度学习·机器学习
凯哥是个大帅比38 分钟前
人工智能ACA(五)--深度学习基础
人工智能·深度学习
海棠AI实验室1 小时前
AI的进阶之路:从机器学习到深度学习的演变(三)
人工智能·深度学习·机器学习
AIGC大时代2 小时前
如何使用ChatGPT辅助文献综述,以及如何进行优化?一篇说清楚
人工智能·深度学习·chatgpt·prompt·aigc
人机与认知实验室4 小时前
人、机、环境中各有其神经网络系统
人工智能·深度学习·神经网络·机器学习
靴子学长9 小时前
基于字节大模型的论文翻译(含免费源码)
人工智能·深度学习·nlp
海棠AI实验室10 小时前
AI的进阶之路:从机器学习到深度学习的演变(一)
人工智能·深度学习·机器学习
苏言の狗12 小时前
Pytorch中关于Tensor的操作
人工智能·pytorch·python·深度学习·机器学习
paixiaoxin15 小时前
CV-OCR经典论文解读|An Empirical Study of Scaling Law for OCR/OCR 缩放定律的实证研究
人工智能·深度学习·机器学习·生成对抗网络·计算机视觉·ocr·.net