AI

https://github.com/invoke-ai/InvokeAI

Invoke AI runs quite well on M1 Macs and we have a number of M1 users in the community. While the repo does run on Intel Macs, we only have a couple reports. If you have an Intel Mac and run into issues, please create an issue on Github and we will do our best to help.

Requirements

macOS 12.3 Monterey or later

About 10GB of storage (and 10GB of data if your internet connection has data caps)

Any M1 Macs or an Intel Macs with 4GB+ of VRAM (ideally more)

Installation

First you need to download a large checkpoint file.

Sign up at https://huggingface.co   [email protected]

Go to the Stable diffusion diffusion model page

Accept the terms and click Access Repository

Download sd-v1-4.ckpt (4.27 GB) and note where you have saved it (probably the Downloads folder). You may want to move it somewhere else for longer term storage - SD needs this file to run.

While that is downloading, open Terminal and run the following commands one at a time, reading the comments and taking care to run the appropriate command for your Mac’s architecture (Intel or M1).

Homebrew

If you have no brew installation yet (otherwise skip):

install brew (and Xcode command line tools)

/bin/bash -c ”$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)“

Conda Installation

brew install cmake protobuf rust

Create the environment & install packages

Then clone the InvokeAI repository:

bash title=“Clone the InvokeAI repository:

Clone the Invoke AI repo

git clone https://github.com/invoke-ai/InvokeAI.git

cd InvokeAI

curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh \

      -o Miniconda3-latest-MacOSX-arm64.sh

/bin/bash Miniconda3-latest-MacOSX-arm64.sh

Wait until the checkpoint-file download finished, then proceed

We will leave the big checkpoint wherever you stashed it for long-term storage, and make a link to it from the repo’s folder. This allows you to use it for other repos, or if you need to delete Invoke AI, you won’t have to download it again.

Make the directory in the repo for the symlink

mkdir -p models/ldm/stable-diffusion-v1/

This is the folder where you put the checkpoint file sd-v1-4.ckpt

PATH_TO_CKPT=“$HOME/Downloads”

Create a link to the checkpoint

ln -s “$PATH_TO_CKPT/sd-v1-4.ckpt” models/ldm/stable-diffusion-v1/model.ckpt

ln -s “/Users/dcq/Desktop/Project/Python/sd-v1-4.ckpt” models/ldm/stable-diffusion-v1/model.ckpt

更新项目代码

git pull

激活环境

conda env create -f environments-and-requirements/environment-mac.yml

conda activate invokeai

更新环境,yml中关于git部分包手动安装,大环境你懂得

conda env update -f environments-and-requirements/environment-mac.yml

pip install git+https://github.com/openai/CLIP.git@main#egg=clip

pip install git+https://github.com/invoke-ai/k-diffusion.git@mps#egg=k_diffusion

pip install git+https://github.com/invoke-ai/Real-ESRGAN.git#egg=realesrgan

pip install git+https://github.com/invoke-ai/GFPGAN.git#egg=gfpgan

pip install git+https://github.com/invoke-ai/clipseg.git@relaxed-python-requirement#egg=clipseg

pip install -e .

pip install getpass_asterisk

预先加在模型

This will download some bits and pieces and make take a while

python scripts/preload_models.py

Token : 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

export PYTORCH_ENABLE_MPS_FALLBACK=1

or run the web interface!

(invokeai) python scripts/invoke.py —web

The original scripts should work as well.

(invokeai) python scripts/orig_scripts/txt2img.py \

    —prompt “a photograph of an astronaut riding a horse” \

    —plms

website

python scripts/invoke.py —web

WebSite

https://invoke-ai.github.io/InvokeAI/features/WEB/#acknowledgements

Steps(nference_steps)降噪步骤数,默认50,1-250,数值越大质量越高,耗时越久。

CFG Scale:能够增加每个tag对画面整体的影响(cfg scale越高,tag权重和先后顺序的差异表现得越明显)。过高的cfg scale搭配过低的step会导致画面颜色饱和度过高;过低的cfg scale则能起到相反的极端效果。过低的step值会导致画面不成型,甚至是黑屏花屏;过高的step则需要足够大的画布像素才能体现出具体效果。

Seed :种子,你可以将一张生成的图片设定为一串数字,成为种子。固定种子之后修改tag或步数,AI会优先根据你种子的这种图片来进行修改,适合一张人物立绘修改表情、服装时候使用

Ayami Kojima, black long hair, cute face, 1 adlut girl, happy, green skirt dress, flower pattern in dress, solo, green gown, art of light novel, in field

 

https://huggingface.co/stabilityai/stable-diffusion-2-1/tree/main

https://huggingface.co/stabilityai/sd-vae-ft-mse/resolve/main/diffusion_pytorch_model.bin