Skip to content

Commit 578d316

Browse files
committed
update Windows/Linux environment install
1 parent 50c6b3d commit 578d316

File tree

3 files changed

+132
-8
lines changed

3 files changed

+132
-8
lines changed

README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ There is an HD video on [Youtube](https://www.youtube.com/watch?v=5DiKfONMnE4).
1919
2020
- [🪶 MagicQuill: An Intelligent Interactive Image Editing System](#-magicquill-an-intelligent-interactive-image-editing-system)
2121
- [TODO List](#todo-list)
22+
- [Update Log](#update-log)
2223
- [Hardware Requirements](#hardware-requirements)
2324
- [Setup](#setup)
2425
- [Tutorial](#tutorial)
@@ -35,6 +36,10 @@ There is an HD video on [Youtube](https://www.youtube.com/watch?v=5DiKfONMnE4).
3536

3637
<img src="docs/comfyui.png" width="50%" >
3738

39+
## Update Log
40+
41+
- [2024.11.21] Update the save button; Fix path bug on Windows; Add `.bat` and `.sh` files for convenient environment install on Windows and Linux.
42+
3843
## Hardware Requirements
3944

4045
- GPU is required to run MagicQuill. **Through our testing, we have confirmed that the model can run on GPUs with 8GB VRAM.**
@@ -43,9 +48,9 @@ For users with limited GPU resources, please try our [Huggingface Demo](https://
4348

4449

4550
## Setup
46-
If you are a Linux user, follow the following guide to set up the environment. If you are a Windows user, you may find [this](https://github.com/magic-quill/MagicQuill/issues/11) helpful.
51+
Follow the following guide to set up the environment.
4752

48-
1. git clone repo
53+
1. git clone repo. **Please don't forget the `--recursive` flag.** Otherwise, you will find `LLaVA` submodule missing.
4954
```
5055
git clone --recursive https://github.com/magic-quill/MagicQuill.git
5156
cd MagicQuill
@@ -57,20 +62,26 @@ If you are a Linux user, follow the following guide to set up the environment. I
5762
```
5863
If the .zip file is not accessible, download it via browser. All checkpoints are about 25 GB in total. It may take some time to download. Alternatively, check our checkpoints at [huggingface](https://huggingface.co/LiuZichen/MagicQuill-models).
5964
65+
---
66+
67+
If you are a Windows user, you may try to use `windows_setup.bat` to conveniently install environments. For Linux user, check `linux_setup.sh`.
68+
69+
Alternatively, follow the step-by-step installation guide.
70+
6071
3. create environment
6172
```
6273
conda create -n MagicQuill python=3.10 -y
6374
conda activate MagicQuill
6475
```
6576
66-
4. install the interface
77+
4. install torch with GPU support
6778
```
68-
pip install gradio_magicquill-0.0.1-py3-none-any.whl
79+
pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu118
6980
```
7081
71-
5. install torch with GPU support
82+
5. install the interface
7283
```
73-
pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu118
84+
pip install gradio_magicquill-0.0.1-py3-none-any.whl
7485
```
7586
7687
6. install llava environment
@@ -87,12 +98,12 @@ If you are a Linux user, follow the following guide to set up the environment. I
8798
```
8899
89100
90-
8. install the remaining environment
101+
7. install the remaining environment
91102
```
92103
pip install -r requirements.txt
93104
```
94105
95-
9. run magicquill
106+
8. run magicquill
96107
```
97108
python gradio_run.py
98109
```

linux_setup.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
3+
CONDA_PATH=$(conda info --base)
4+
source "$CONDA_PATH/etc/profile.d/conda.sh"
5+
6+
# Create conda environment if it doesn't exist
7+
if ! conda env list | grep -q "MagicQuill"; then
8+
echo "Creating conda environment MagicQuill..."
9+
conda create -n MagicQuill python=3.10 -y
10+
11+
# Initialize conda after creating new environment
12+
echo "Initializing conda..."
13+
conda init bash
14+
15+
echo "Environment created. Please run this script again to continue installation."
16+
exit 0
17+
fi
18+
19+
# Activate conda environment
20+
echo "Activating conda environment..."
21+
conda activate MagicQuill
22+
23+
# Install PyTorch with CUDA 11.8
24+
echo "Installing PyTorch 2.1.2 with CUDA 11.8..."
25+
pip install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu118
26+
27+
# Verify PyTorch installation and CUDA availability
28+
python -c "import torch; print('PyTorch version:', torch.version); print('CUDA available:', torch.cuda.is_available())"
29+
if [ $? -ne 0 ]; then
30+
echo "Failed to install or verify PyTorch"
31+
exit 1
32+
fi
33+
34+
# Install the required interface package
35+
echo "Installing gradio_magicquill..."
36+
pip install gradio_magicquill-0.0.1-py3-none-any.whl
37+
38+
# Install the llava environment
39+
echo "Setting up LLaVA environment..."
40+
if [ ! -d "MagicQuill/LLaVA" ]; then
41+
echo "Directory MagicQuill/LLaVA does not exist. Ensure the folder structure is correct."
42+
exit 1
43+
fi
44+
cp -f pyproject.toml MagicQuill/LLaVA/
45+
pip install -e MagicQuill/LLaVA/
46+
47+
# Install remaining dependencies
48+
echo "Installing additional requirements..."
49+
pip install -r requirements.txt
50+
51+
# Run MagicQuill
52+
echo "Starting MagicQuill..."
53+
export CUDA_VISIBLE_DEVICES=0
54+
python gradio_run.py || {
55+
echo "Error: Failed to run MagicQuill."
56+
exit 1
57+
}

windows_setup.bat

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
:: Create conda environment if it doesn't exist
2+
conda env list | find "MagicQuill" &gt;nul 2&gt;nul
3+
if %ERRORLEVEL% NEQ 0 (
4+
echo Creating conda environment MagicQuill...
5+
call conda create -n MagicQuill python=3.10 -y
6+
7+
:: Initialize conda after creating new environment
8+
echo Initializing conda...
9+
call conda init cmd.exe
10+
11+
echo Environment created. Please run this script again to continue installation.
12+
pause
13+
exit /b 0
14+
)
15+
16+
:: Activate conda environment
17+
echo Activating conda environment...
18+
call conda activate MagicQuill
19+
20+
:: Install PyTorch with CUDA 11.8
21+
echo Installing PyTorch 2.1.2 with CUDA 11.8...
22+
pip install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu118
23+
24+
:: Verify PyTorch installation and CUDA availability
25+
python -c "import torch; print('PyTorch version:', torch.__version__); print('CUDA available:', torch.cuda.is_available())"
26+
if %ERRORLEVEL% NEQ 0 (
27+
echo Failed to install or verify PyTorch
28+
pause
29+
exit /b 1
30+
)
31+
32+
:: Install the required interface package
33+
echo Installing gradio_magicquill...
34+
pip install gradio_magicquill-0.0.1-py3-none-any.whl
35+
36+
:: Install the llava environment
37+
echo Setting up LLaVA environment...
38+
if not exist MagicQuill\LLaVA (
39+
echo Directory MagicQuill\LLaVA does not exist. Ensure the folder structure is correct.
40+
exit /b 1
41+
)
42+
copy /y pyproject.toml MagicQuill\LLaVA
43+
pip install -e MagicQuill\LLaVA\
44+
45+
:: Install remaining dependencies
46+
echo Installing additional requirements...
47+
pip install -r requirements.txt
48+
49+
:: Run MagicQuill
50+
echo Starting MagicQuill...
51+
set CUDA_VISIBLE_DEVICES=0
52+
python gradio_run.py || (
53+
echo Error: Failed to run MagicQuill.
54+
pause
55+
exit /b 1
56+
)

0 commit comments

Comments
 (0)