update Windows/Linux environment install

This commit is contained in:
LIU, Zichen
2024-11-21 22:17:24 +08:00
parent 50c6b3d45a
commit 578d316848
3 changed files with 134 additions and 10 deletions
+21 -10
View File
@@ -19,6 +19,7 @@ There is an HD video on [Youtube](https://www.youtube.com/watch?v=5DiKfONMnE4).
- [🪶 MagicQuill: An Intelligent Interactive Image Editing System](#-magicquill-an-intelligent-interactive-image-editing-system)
- [TODO List](#todo-list)
- [Update Log](#update-log)
- [Hardware Requirements](#hardware-requirements)
- [Setup](#setup)
- [Tutorial](#tutorial)
@@ -35,6 +36,10 @@ There is an HD video on [Youtube](https://www.youtube.com/watch?v=5DiKfONMnE4).
<img src="docs/comfyui.png" width="50%" >
## Update Log
- [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.
## Hardware Requirements
- 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://
## Setup
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.
Follow the following guide to set up the environment.
1. git clone repo
1. git clone repo. **Please don't forget the `--recursive` flag.** Otherwise, you will find `LLaVA` submodule missing.
```
git clone --recursive https://github.com/magic-quill/MagicQuill.git
cd MagicQuill
@@ -57,22 +62,28 @@ If you are a Linux user, follow the following guide to set up the environment. I
```
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).
---
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`.
Alternatively, follow the step-by-step installation guide.
3. create environment
```
conda create -n MagicQuill python=3.10 -y
conda activate MagicQuill
```
4. install the interface
```
pip install gradio_magicquill-0.0.1-py3-none-any.whl
```
5. install torch with GPU support
4. install torch with GPU support
```
pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu118
```
5. install the interface
```
pip install gradio_magicquill-0.0.1-py3-none-any.whl
```
6. install llava environment
```
(For Linux)
@@ -87,12 +98,12 @@ If you are a Linux user, follow the following guide to set up the environment. I
```
8. install the remaining environment
7. install the remaining environment
```
pip install -r requirements.txt
```
9. run magicquill
8. run magicquill
```
python gradio_run.py
```
+57
View File
@@ -0,0 +1,57 @@
#!/bin/bash
CONDA_PATH=$(conda info --base)
source "$CONDA_PATH/etc/profile.d/conda.sh"
# Create conda environment if it doesn't exist
if ! conda env list | grep -q "MagicQuill"; then
echo "Creating conda environment MagicQuill..."
conda create -n MagicQuill python=3.10 -y
# Initialize conda after creating new environment
echo "Initializing conda..."
conda init bash
echo "Environment created. Please run this script again to continue installation."
exit 0
fi
# Activate conda environment
echo "Activating conda environment..."
conda activate MagicQuill
# Install PyTorch with CUDA 11.8
echo "Installing PyTorch 2.1.2 with CUDA 11.8..."
pip install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu118
# Verify PyTorch installation and CUDA availability
python -c "import torch; print('PyTorch version:', torch.version); print('CUDA available:', torch.cuda.is_available())"
if [ $? -ne 0 ]; then
echo "Failed to install or verify PyTorch"
exit 1
fi
# Install the required interface package
echo "Installing gradio_magicquill..."
pip install gradio_magicquill-0.0.1-py3-none-any.whl
# Install the llava environment
echo "Setting up LLaVA environment..."
if [ ! -d "MagicQuill/LLaVA" ]; then
echo "Directory MagicQuill/LLaVA does not exist. Ensure the folder structure is correct."
exit 1
fi
cp -f pyproject.toml MagicQuill/LLaVA/
pip install -e MagicQuill/LLaVA/
# Install remaining dependencies
echo "Installing additional requirements..."
pip install -r requirements.txt
# Run MagicQuill
echo "Starting MagicQuill..."
export CUDA_VISIBLE_DEVICES=0
python gradio_run.py || {
echo "Error: Failed to run MagicQuill."
exit 1
}
+56
View File
@@ -0,0 +1,56 @@
:: Create conda environment if it doesn't exist
conda env list | find "MagicQuill" &gt;nul 2&gt;nul
if %ERRORLEVEL% NEQ 0 (
echo Creating conda environment MagicQuill...
call conda create -n MagicQuill python=3.10 -y
:: Initialize conda after creating new environment
echo Initializing conda...
call conda init cmd.exe
echo Environment created. Please run this script again to continue installation.
pause
exit /b 0
)
:: Activate conda environment
echo Activating conda environment...
call conda activate MagicQuill
:: Install PyTorch with CUDA 11.8
echo Installing PyTorch 2.1.2 with CUDA 11.8...
pip install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu118
:: Verify PyTorch installation and CUDA availability
python -c "import torch; print('PyTorch version:', torch.__version__); print('CUDA available:', torch.cuda.is_available())"
if %ERRORLEVEL% NEQ 0 (
echo Failed to install or verify PyTorch
pause
exit /b 1
)
:: Install the required interface package
echo Installing gradio_magicquill...
pip install gradio_magicquill-0.0.1-py3-none-any.whl
:: Install the llava environment
echo Setting up LLaVA environment...
if not exist MagicQuill\LLaVA (
echo Directory MagicQuill\LLaVA does not exist. Ensure the folder structure is correct.
exit /b 1
)
copy /y pyproject.toml MagicQuill\LLaVA
pip install -e MagicQuill\LLaVA\
:: Install remaining dependencies
echo Installing additional requirements...
pip install -r requirements.txt
:: Run MagicQuill
echo Starting MagicQuill...
set CUDA_VISIBLE_DEVICES=0
python gradio_run.py || (
echo Error: Failed to run MagicQuill.
pause
exit /b 1
)