xingxm commited on
Commit
6d17b23
ยท
1 Parent(s): 9fef92e

fix(docker): fix docker script

Browse files
Files changed (3) hide show
  1. .gitignore +3 -1
  2. README.md +42 -28
  3. 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
- [![cvpr24](https://img.shields.io/badge/CVPR-2024-387ADF.svg)](https://arxiv.org/abs/2312.16476)
4
- [![arXiv](https://img.shields.io/badge/arXiv-2312.16476-b31b1b.svg)](https://arxiv.org/abs/2312.16476)
5
- [![website](https://img.shields.io/badge/Website-Gitpage-4CCD99)](https://ximinng.github.io/SVGDreamer-project/)
6
- [![blog](https://img.shields.io/badge/Blog-EN-9195F6)](https://huggingface.co/blog/xingxm/svgdreamer)
7
- [![blog](https://img.shields.io/badge/Blog-CN-9195F6)](https://mp.weixin.qq.com/s/QEBiP-xLVvQVoV_9H2Id7g)
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,46 +13,58 @@ prompts.
13
  ![title](./assets/illustrate.png)
14
  ![title](./assets/teaser_svg_asset.png)
15
 
16
- ## :new: Update
17
 
18
- - [11/2024] ๐Ÿ”ฅ **We released the [SVGDreamer++](https://arxiv.org/abs/2411.17832), offering stronger visual representation and improved editing capabilities.**
 
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
- #### 1. Install Environment
28
 
29
- You can follow the steps below to quickly get up and running with SVGDreamer.
30
- These steps will let you run quick inference locally.
31
 
32
- In the top level directory run,
33
 
34
- ```bash
35
- sh script/install.sh
 
 
36
  ```
37
 
38
- or using docker,
39
 
40
  ```shell
41
- docker run --name svgdreamer --gpus all -it --ipc=host ximingxing/svgrender:v1 /bin/bash
42
  ```
43
 
44
- #### 2. Download Pretrained Stable Diffusion Model
 
 
 
 
 
45
 
46
- **Downloading pretrained SD models** by setting `diffuser.download=True` in `/conf/config.yaml` the first time you run
47
- it.
48
- (Alternatively, you can append `diffuser.download=True` to the end of the script.)
49
 
50
- Or you can still download it manually,
51
 
52
- - Model Link: https://huggingface.co/stabilityai/stable-diffusion-2-1-base
53
- - Default model is stored in the `/home/user/.cache/huggingface/hub/models--stabilityai--stable-diffusion-2-1-base`
54
 
55
- ## ๐Ÿ”ฅ Quickstart: synthesize **6** SVGs at once
 
 
 
 
 
 
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
- #### More Cases
213
 
214
- **See [Examples.md](https://github.com/ximinng/DiffSketcher/blob/main/Examples.md) for more cases.**
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
+ [![CVPR 2024](https://img.shields.io/badge/CVPR%202024-Paper-4169E1?style=for-the-badge&logo=arxiv&logoColor=white)](https://arxiv.org/abs/2312.16476)
4
+ [![arXiv](https://img.shields.io/badge/arXiv-2312.16476-8A2BE2?style=for-the-badge&logo=arxiv&logoColor=white)](https://arxiv.org/abs/2312.16476)
5
+ [![Project Website](https://img.shields.io/badge/Website-Project%20Page-4682B4?style=for-the-badge&logo=github&logoColor=white)](https://ximinng.github.io/SVGDreamer-project/)
6
+ [![English Blog](https://img.shields.io/badge/Blog-English-00CED1?style=for-the-badge&logo=huggingface&logoColor=white)](https://huggingface.co/blog/xingxm/svgdreamer)
7
+ [![ไธญๆ–‡ๅšๅฎข](https://img.shields.io/badge/ๅšๅฎข-ไธญๆ–‡-1E90FF?style=for-the-badge&logo=zhihu&logoColor=white)](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
  ![title](./assets/illustrate.png)
14
  ![title](./assets/teaser_svg_asset.png)
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! ===="