Upload DiffSketcher/script/run_docker.sh with huggingface_hub
Browse files
DiffSketcher/script/run_docker.sh
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
set -e
|
4 |
+
|
5 |
+
# Docker image and container name
|
6 |
+
IMAGE_NAME="ximingxing/svgrender:v1"
|
7 |
+
CONTAINER_NAME="diffsketcher"
|
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 DiffSketcher example ===='
|
30 |
+
python run_painterly_render.py \
|
31 |
+
-c diffsketcher.yaml \
|
32 |
+
-eval_step 10 -save_step 10 \
|
33 |
+
-update 'token_ind=4 num_paths=96 num_iter=800' \
|
34 |
+
-pt 'a photo of Sydney opera house' \
|
35 |
+
-respath ./workdir/sydney_opera_house \
|
36 |
+
-d 8019 \
|
37 |
+
--download
|
38 |
+
"
|
39 |
+
|
40 |
+
echo "==== DiffSketcher execution completed! ===="
|