HomeAI News
【SD Novice Tutorial】How to deploy locally on a Mac (intel chip)
16

【SD Novice Tutorial】How to deploy locally on a Mac (intel chip)

Noodleplan-icon
Noodle
March 13th, 2023
View OriginalTranslated by Google

hardware requirements

Apple series computers: either desktop or notebook; non-M chip. Unobstructed network: During the entire installation process, 4G files need to be downloaded.

Installation process

1. Download Stable Diffusion. Download the source code directly from the github website. The code is hosted on github. Students who have the ability to code can use the git tool to clone themselves, and other students can download it directly. Open the link to download the stable-diffusion source code and click to download

Click to download stable-diffusion source code 2. Modify the source code The higher version of cudatoolkit is not yet supported on the Apple system, only version 9.0 can be used [code modification to be supplemented] 3. Create a picture storage directory Download in the project directory and create a directory for storing pictures later: [./stable-diffusion-main/Workspace]. At this point, all the preparatory work is complete. Go down and install the environment through the command, and the picture is generated. 4. Download the model file Steps to download the model file from hugging face: Be sure, the name of the model is [stable-diffusion-v-1-4-original], and the downloaded file is [sd-v1-4.ckpt] with 4.27GB. Put the downloaded file in the directory of the previous project: 【./stable-diffusion-main/models/ldm/sd-v1-4.ckpt】; do not change the location, it will be used later.

In the [Files] tab, download sd-v1-4.ckpt and pay attention to two points: you must register an account on hugging face. You must check to accept the agreement under the [Model card] tab on the page.

Accept agreement before downloading After completing these two steps, you can download the model file in the [Files and versions] tab; otherwise, you will see a 403 error page.

5. Environment installation Download the conda installation software download address of the selected Python3.8 version of conda, the specific file name is Miniconda3 macOS Intel x86 64-bit pkgConda is a python environment management system, used to install multiple versions of software packages and their dependencies, and compile them Easily switch between. This makes it easy to switch between various versions of python. It will not conflict with the python already installed on the computer system. In the project directory, execute the following command

conda env create -f environment.yaml conda activate ldm

Update latent diffusion model conda install pytorch torchvision -c pytorch pip install transformers==4.19.2 diffusers invisible-watermark pip install -e . 6. Drawing Copy the command line below and execute it python scripts/txt2img.py --prompt "Asia girl, glossy eyes, face, long hair, fantasy, elegant, highly detailed, digital painting, artstation, concept art, smooth, illustration, renaissance, flowy, melting, round moons, rich clouds, very detailed, volumetric light, mist, fine art, textured oil over canvas, epic fantasy art, very colorful, ornate intricate scales, fractal gems, 8 k, hyper realistic, high contrast" --plms --outdir ./stable -diffusion-main/Workspace --ckpt ./stable-diffusion-main/models/ldm/sd-v1-4.ckpt --ddim_steps 100 --H 512 --W 512 --seed 8 How to do local deployment on Mac (M chip), please click here .

Comments

no dataCoffee time! Feel free to comment