fix(docker): fix docker script
Browse files- .gitignore +3 -1
- README.md +42 -28
- script/run_svgdreamer_docker.sh +36 -0
.gitignore
CHANGED
|
@@ -168,4 +168,6 @@ lightning_logs/*
|
|
| 168 |
./tmp/*
|
| 169 |
/tmp/
|
| 170 |
/tmp_select/
|
| 171 |
-
/tmp_select/*
|
|
|
|
|
|
|
|
|
| 168 |
./tmp/*
|
| 169 |
/tmp/
|
| 170 |
/tmp_select/
|
| 171 |
+
/tmp_select/*
|
| 172 |
+
/logs/
|
| 173 |
+
/logs/*
|
README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
# SVGDreamer: Text Guided SVG Generation with Diffusion Model
|
| 2 |
|
| 3 |
-
[
|
| 14 |

|
| 15 |
|
| 16 |
-
## :new: Update
|
| 17 |
|
| 18 |
-
- [11/2024] ๐ฅ **We released the [SVGDreamer++](https://arxiv.org/abs/2411.17832), offering stronger visual
|
|
|
|
| 19 |
- [03/2024] ๐ฅ We released the **code** for [SVGDreamer](https://ximinng.github.io/SVGDreamer-project/).
|
| 20 |
- [02/2024] ๐ SVGDreamer accepted by CVPR2024. ๐
|
| 21 |
- [12/2023] ๐ฅ We released the **[SVGDreamer Paper](https://arxiv.org/abs/2312.16476)**. SVGDreamer is
|
| 22 |
a novel text-guided vector graphics synthesis method. This method considers both the editing of vector graphics and
|
| 23 |
the quality of the synthesis.
|
| 24 |
|
| 25 |
-
## Installation
|
| 26 |
|
| 27 |
-
|
| 28 |
|
| 29 |
-
|
| 30 |
-
These
|
| 31 |
|
| 32 |
-
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
| 36 |
```
|
| 37 |
|
| 38 |
-
|
| 39 |
|
| 40 |
```shell
|
| 41 |
-
|
| 42 |
```
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
(Alternatively, you can append `diffuser.download=True` to the end of the script.)
|
| 49 |
|
| 50 |
-
|
| 51 |
|
| 52 |
-
|
| 53 |
-
- Default model is stored in the `/home/user/.cache/huggingface/hub/models--stabilityai--stable-diffusion-2-1-base`
|
| 54 |
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
### SIVE + VPSD
|
| 58 |
|
|
@@ -70,9 +82,11 @@ realistic <br/>
|
|
| 70 |
**Script:**
|
| 71 |
|
| 72 |
```shell
|
| 73 |
-
python svgdreamer.py x=iconography skip_sive=False "prompt='an image of Batman. full body action pose, complete detailed body. white background. empty background, high quality, 4K, ultra realistic'" token_ind=4 x.vpsd.t_schedule='randint' result_path='./logs/batman' multirun=True
|
| 74 |
```
|
| 75 |
|
|
|
|
|
|
|
| 76 |
- `x=iconography`(str): style configs
|
| 77 |
- `skip_sive`(bool): enable the SIVE stage
|
| 78 |
- `token_ind`(int): the index of text prompt, from 1
|
|
@@ -209,11 +223,11 @@ python svgdreamer.py x=sketch "prompt='A free-hand drawing of A speeding Lamborg
|
|
| 209 |
python svgdreamer.py x=ink "prompt='Big Wild Goose Pagoda. ink style. Minimalist abstract art grayscale watercolor. empty background'" neg_prompt='' result_path='./logs/BigWildGoosePagoda'
|
| 210 |
```
|
| 211 |
|
| 212 |
-
####
|
| 213 |
|
| 214 |
-
**
|
| 215 |
|
| 216 |
-
## ๐ Tips
|
| 217 |
|
| 218 |
- I highly recommend turning on xformer `enable_xformers=True` to speed up optimization.
|
| 219 |
- `x.vpsd.t_schedule` greatly affects the style of the result. Please try more.
|
|
|
|
| 1 |
# SVGDreamer: Text Guided SVG Generation with Diffusion Model
|
| 2 |
|
| 3 |
+
[](https://arxiv.org/abs/2312.16476)
|
| 4 |
+
[](https://arxiv.org/abs/2312.16476)
|
| 5 |
+
[](https://ximinng.github.io/SVGDreamer-project/)
|
| 6 |
+
[](https://huggingface.co/blog/xingxm/svgdreamer)
|
| 7 |
+
[](https://zhuanlan.zhihu.com/p/687525994)
|
| 8 |
|
| 9 |
This repository contains the official implementation of our CVPR 2024 paper, "SVGDreamer: Text-Guided SVG Generation
|
| 10 |
with Diffusion Model." The method leverages a diffusion-based approach to produce high-quality SVGs guided by text
|
|
|
|
| 13 |

|
| 14 |

|
| 15 |
|
| 16 |
+
## :new: Latest Update
|
| 17 |
|
| 18 |
+
- [11/2024] ๐ฅ **We released the [SVGDreamer++](https://arxiv.org/abs/2411.17832), offering stronger visual
|
| 19 |
+
representation and improved editing capabilities.**
|
| 20 |
- [03/2024] ๐ฅ We released the **code** for [SVGDreamer](https://ximinng.github.io/SVGDreamer-project/).
|
| 21 |
- [02/2024] ๐ SVGDreamer accepted by CVPR2024. ๐
|
| 22 |
- [12/2023] ๐ฅ We released the **[SVGDreamer Paper](https://arxiv.org/abs/2312.16476)**. SVGDreamer is
|
| 23 |
a novel text-guided vector graphics synthesis method. This method considers both the editing of vector graphics and
|
| 24 |
the quality of the synthesis.
|
| 25 |
|
| 26 |
+
## ๐ Installation Guide
|
| 27 |
|
| 28 |
+
### ๐ ๏ธ Step 1: Set Up the Environment
|
| 29 |
|
| 30 |
+
To quickly get started with **SVGDreamer**, follow the steps below.
|
| 31 |
+
These instructions will help you run **quick inference locally**.
|
| 32 |
|
| 33 |
+
#### ๐ **Option 1: Standard Installation**
|
| 34 |
|
| 35 |
+
Run the following command in the **top-level directory**:
|
| 36 |
+
|
| 37 |
+
```shell
|
| 38 |
+
bash script/install.sh
|
| 39 |
```
|
| 40 |
|
| 41 |
+
#### ๐ณ Option 2: Using Docker
|
| 42 |
|
| 43 |
```shell
|
| 44 |
+
sudo bash script/run_svgdreamer_docker.sh
|
| 45 |
```
|
| 46 |
|
| 47 |
+
### ๐ ๏ธ Step 2: Download Pretrained Stable Diffusion Model
|
| 48 |
+
|
| 49 |
+
SVGDreamer requires a pretrained Stable Diffusion (SD) model.
|
| 50 |
+
You can download it automatically or manually.
|
| 51 |
+
|
| 52 |
+
#### ๐ Option 1: Auto-Download (Recommended)
|
| 53 |
|
| 54 |
+
Set `diffuser.download=True` in `/conf/config.yaml` before running SVGDreamer.
|
| 55 |
+
Alternatively, append `diffuser.download=True` to the execution script.
|
|
|
|
| 56 |
|
| 57 |
+
#### โฌ๏ธ Option 2: Manual Download
|
| 58 |
|
| 59 |
+
If you prefer manual setup, download the model from Hugging Face:
|
|
|
|
| 60 |
|
| 61 |
+
๐ Model Link: [Stable Diffusion 2.1 Base](https://huggingface.co/stabilityai/stable-diffusion-2-1-base)
|
| 62 |
+
|
| 63 |
+
The model will be stored at:
|
| 64 |
+
|
| 65 |
+
๐ Default Path: `/home/user/.cache/huggingface/hub/models--stabilityai--stable-diffusion-2-1-base`
|
| 66 |
+
|
| 67 |
+
## ๐ฅ Quickstart: synthesize **6** SVGs at once
|
| 68 |
|
| 69 |
### SIVE + VPSD
|
| 70 |
|
|
|
|
| 82 |
**Script:**
|
| 83 |
|
| 84 |
```shell
|
| 85 |
+
python svgdreamer.py x=iconography skip_sive=False "prompt='an image of Batman. full body action pose, complete detailed body. white background. empty background, high quality, 4K, ultra realistic'" token_ind=4 x.sive.bg.num_iter=10 x.sive.fg.num_iter=10 x.vpsd.t_schedule='randint' result_path='./logs/batman' multirun=True
|
| 86 |
```
|
| 87 |
|
| 88 |
+
๐นParameter:
|
| 89 |
+
|
| 90 |
- `x=iconography`(str): style configs
|
| 91 |
- `skip_sive`(bool): enable the SIVE stage
|
| 92 |
- `token_ind`(int): the index of text prompt, from 1
|
|
|
|
| 223 |
python svgdreamer.py x=ink "prompt='Big Wild Goose Pagoda. ink style. Minimalist abstract art grayscale watercolor. empty background'" neg_prompt='' result_path='./logs/BigWildGoosePagoda'
|
| 224 |
```
|
| 225 |
|
| 226 |
+
#### ๐จ Supported Styles
|
| 227 |
|
| 228 |
+
**For more examples, visit [Examples.md](https://github.com/ximinng/DiffSketcher/blob/main/Examples.md)**.
|
| 229 |
|
| 230 |
+
## ๐ Tips for Best Results
|
| 231 |
|
| 232 |
- I highly recommend turning on xformer `enable_xformers=True` to speed up optimization.
|
| 233 |
- `x.vpsd.t_schedule` greatly affects the style of the result. Please try more.
|
script/run_svgdreamer_docker.sh
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
set -e
|
| 4 |
+
|
| 5 |
+
# Docker image and container name
|
| 6 |
+
IMAGE_NAME="ximingxing/svgrender:v1"
|
| 7 |
+
CONTAINER_NAME="svgdreamer"
|
| 8 |
+
|
| 9 |
+
echo "==== 1. Pulling Docker image ===="
|
| 10 |
+
docker pull $IMAGE_NAME
|
| 11 |
+
|
| 12 |
+
echo "==== 2. Starting Docker container ===="
|
| 13 |
+
# Check if a container with the same name exists, and remove it if necessary
|
| 14 |
+
if [ "$(docker ps -aq -f name=$CONTAINER_NAME)" ]; then
|
| 15 |
+
echo "Existing container found, removing old container..."
|
| 16 |
+
docker rm -f $CONTAINER_NAME
|
| 17 |
+
fi
|
| 18 |
+
|
| 19 |
+
# Run the Docker container with GPU support and mount the current directory
|
| 20 |
+
docker run --name $CONTAINER_NAME --gpus all -it --ipc=host -v $(pwd):/workspace $IMAGE_NAME /bin/bash -c "
|
| 21 |
+
echo '==== 3. Activating Conda environment ===='
|
| 22 |
+
source /opt/conda/etc/profile.d/conda.sh
|
| 23 |
+
conda activate svgrender
|
| 24 |
+
|
| 25 |
+
echo '==== 4. Installing missing dependencies ===='
|
| 26 |
+
pip install cairosvg
|
| 27 |
+
apt update && apt install -y libcairo2-dev
|
| 28 |
+
|
| 29 |
+
echo '==== 5. Running SVGDreamer example ===='
|
| 30 |
+
python svgdreamer.py x=iconography skip_sive=False \\
|
| 31 |
+
\"prompt='an image of Batman. full body action pose, complete detailed body. white background. empty background, high quality, 4K, ultra realistic'\" \\
|
| 32 |
+
token_ind=4 x.vpsd.t_schedule='randint' \\
|
| 33 |
+
result_path='./logs/batman' multirun=True
|
| 34 |
+
"
|
| 35 |
+
|
| 36 |
+
echo "==== SVGDreamer execution completed! ===="
|