Location>code7788 >text

MagicQuill, AI dynamic image element modification, AI drawing, requires 40G of local hard disk space, 12G of video memory can play, Win11 local deployment

Popularity:493 ℃/2024-11-21 20:34:53

Recently by magic-quill team open source MagicQuill project is very attention, this project can be customized gradio client for different image elements through the cue word to modify, so as to generate a new image. It is worth mentioning that this project is quite friendly , only 20 steps of iterative model prediction , dessert card 10 seconds to get the picture of the modified effect , but the cost is at least 40 G or so of disk space .

This time we share how to deploy MagicQuill project locally (Windows 11).

First you need to download the dependency weighting model, zip at.

/:u:/g/personal/zliucz_connect_ust_hk/EWlGF0WfawJIrJ1Hn85_-3gB0MtwImAnYeWXuleVQcukMg?e=Gcjugg&download=1

We recommend using a certain thunder to download, the speed will be a little faster.

Note that weight decompression requires about 30G of hard disk space, please reserve the appropriate disk space.

Subsequently, clone the official and updated code: the

git clone --recursive /magic-quill/  
cd MagicQuill

Put the unzipped models directory into the root directory of your project.

Directory structure after copy weights:

E:magicQuill-main>treee -L 1
MagicQuill-main
├── LICENSE
├── MagicQuill
├──
├── check_env.py
├── docs
├── gradio_magicquill-0.0.  
├── gradio_run.py
├── hf_download
├── models
├── py311_cu118
├──
├──
├── tf_download
├── Detecting the operating environment.bat
└── (of a computer) run.bat

Afterwards, make sure that python 3.11 is installed locally; the installer can be downloaded from the official website.

Of course conda can also be used:

conda create -n MagicQuill python=3.11 -y  
conda activate MagicQuill

Officially, python 3.10 is recommended, but it has been verified that python 3.11 can also run with better performance.

Subsequently install the official customized version of the gradio client:

pip install gradio_magicquill-0.0.

Due to the project's dependency on LLaVA, it is officially recommended to use pip to install:.

(For Windows)  
copy /Y  MagicQuill\LLaVA\  
pip install -e MagicQuill\LLaVA\

But in reality, as we all know, the pip install -e command is used to install a Python package in development mode. Instead of copying the package files to your site-packages directory, it creates a symbolic link to the package source directory. This means that any changes to your project's code will be reflected in your Python environment immediately, without having to reinstall. This is useful for development and debugging. However, if your project needs to be migrated frequently, such as copied to another disk or sent to a colleague, this package will report errors.

So go straight to the official LLaVA project and clone the project directly :)

git clone /haotian-liu/

Then copy the llava directory from the project to the Lib\site-packages directory of the current Python environment. For example, if the author's Python 3.11 environment is installed in the E:\work\MagicQuill-main\py311_cu118\ directory, then copy the llava directory to E:\\ work\MagicQuill-main\py311_cu118\Lib\site-packages. work\MagicQuill-main\py311_cu118\Lib\site-packages.

This way the module will not be invalidated even if the project is migrated.

Next, go back to the MagicQuill project and install the base dependencies.

pip3 install -r 

And then the torch three-piece set was installed.

pip3 install torch torchvision torchaudio --index-url /whl/cu118

Next, modify the gradio_run.py file to include this code::

ckpt_name = (  
                    label="Base Model Name",  
                    choices=folder_paths.get_filename_list("checkpoints"),  
                    value='SD1.5/realisticVisionV60B1_v51VAE.safetensors',  
                    interactive=True  
                )

Amend to read.

default_model = ('SD1.5', 'realisticVisionV60B1_v51VAE.safetensors')  
                ckpt_name = (  
                label="Base Model Name",  
                choices=folder_paths.get_filename_list("checkpoints"),  
                value=default_model,  
                interactive=True  
                )

means to add a default value to the base model.

Set the environment variables:

set HF_ENDPOINT=  
set CUDA_VISIBLE_DEVICES=0

Finally, start the service by running the command.

python3 gradio_run.py

The program returns.

model_type EPS  
Using pytorch attention in VAE  
Using pytorch attention in VAE  
self.brushnet_loader.inpaint_files:  {'brushnet\\random_mask_brushnet_ckpt\\diffusion_pytorch_model.safetensors': 'E:\\work\\MagicQuill-main\\MagicQuill\\../models\\inpaint', 'brushnet\\segmentation_mask_brushnet_ckpt\\diffusion_pytorch_model.safetensors': 'E:\\work\\MagicQuill-main\\MagicQuill\\../models\\inpaint'}  
BrushNet model file: E:\work\MagicQuill-main\MagicQuill\../models\inpaint\brushnet\random_mask_brushnet_ckpt\diffusion_pytorch_model.safetensors  
BrushNet model type: SD1.5  
BrushNet model file: E:\work\MagicQuill-main\MagicQuill\../models\inpaint\brushnet\random_mask_brushnet_ckpt\diffusion_pytorch_model.safetensors  
Some parameters are on the meta device device because they were offloaded to the cpu.  
BrushNet SD1.5 model is loaded  
INFO:     Started server process [41504]  
INFO:     Waiting for application startup.  
INFO:     Application startup complete.  
INFO:     Uvicorn running on http://127.0.0.1:7860 (Press CTRL+C to quit)  
HTTP Request: GET /pkg-version "HTTP/1.1 200 OK"

Indicates a successful deployment.

Access:http://127.0.0.1:7860

So much for having a good time locally.