Skip to content

Instantly share code, notes, and snippets.

@ogrew
Last active June 27, 2023 23:28
Show Gist options
  • Save ogrew/4476252598561fb1270ddc5380124301 to your computer and use it in GitHub Desktop.
Save ogrew/4476252598561fb1270ddc5380124301 to your computer and use it in GitHub Desktop.
DualStyleGAN setup
# pull ubuntu 18.04 as base image
FROM nvidia/cuda:11.3.0-devel-ubuntu20.04
RUN echo "start building..."
# update packages
RUN set -x && \
apt update && \
apt upgrade -y
RUN DEBIAN_FRONTEND=noninteractive apt install -y tzdata
# install command
RUN set -x && \
apt install -y wget && \
apt install -y sudo && \
apt install -y cmake && \
apt install -y build-essential libx11-dev libopenblas-dev liblapack-dev && \
apt install -y libgl1-mesa-dev libglib2.0-0
# anaconda
RUN set -x && \
wget https://repo.anaconda.com/archive/Anaconda3-2022.10-Linux-x86_64.sh && \
bash Anaconda3-2022.10-Linux-x86_64.sh -b && \
rm Anaconda3-2022.10-Linux-x86_64.sh
# path setteing
ENV PATH $PATH:/root/anaconda3/bin
# install dlib
RUN pip install -U pip &&\
pip install --no-cache-dir dlib==19.21.0 &&\
pip install scipy==1.7.0
# update conda
RUN conda update --all
name: dk
channels:
- <unknown>
- defaults
- pytorch
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- asttokens=2.0.5=pyhd3eb1b0_0
- backcall=0.2.0=pyhd3eb1b0_0
- blas=1.0=openblas
- brotli=1.0.9=h166bdaf_7
- brotli-bin=1.0.9=h166bdaf_7
- brotlipy=0.7.0=py38h27cfd23_1003
- bzip2=1.0.8=h7f98852_4
- ca-certificates=2023.05.30=h06a4308_0
- cairo=1.16.0=hb05425b_4
- certifi=2023.5.7=py38h06a4308_0
- cffi=1.15.1=py38h5eee18b_3
- charset-normalizer=2.0.4=pyhd3eb1b0_0
- cloudpickle=2.2.1=py38h06a4308_0
- colorama=0.4.6=pyhd8ed1ab_0
- contourpy=1.0.5=py38hdb19cb5_0
- cryptography=39.0.1=py38h9ce1e76_2
- cudatoolkit=11.3.1=h2bc3f7f_2
- cycler=0.11.0=pyhd8ed1ab_0
- cytoolz=0.12.0=py38h5eee18b_0
- dask-core=2022.2.1=pyhd3eb1b0_0
- dbus=1.13.18=hb2f20db_0
- decorator=5.1.1=pyhd3eb1b0_0
- eigen=3.4.0=h4bd325d_0
- executing=0.8.3=pyhd3eb1b0_0
- expat=2.2.10=h9c3ff4c_0
- faiss=1.7.1=py38h7b17aaf_1_cpu
- ffmpeg=4.2.2=h20bf706_0
- fontconfig=2.14.1=hef1e5e3_0
- fonttools=4.25.0=pyhd3eb1b0_0
- freetype=2.12.1=h4a9f257_0
- fsspec=2023.4.0=py38h06a4308_0
- future=0.18.3=pyhd8ed1ab_0
- giflib=5.2.1=h5eee18b_3
- glib=2.69.1=he621ea3_2
- gmp=6.2.1=h58526e2_0
- gnutls=3.6.13=h85f3911_1
- graphite2=1.3.14=h295c915_1
- gst-plugins-base=1.14.1=h6a678d5_1
- gstreamer=1.14.1=h5eee18b_1
- harfbuzz=4.3.0=hf52aaf7_1
- hdf5=1.10.6=h3ffc7dd_1
- icu=58.2=hf484d3e_1000
- idna=3.4=py38h06a4308_0
- imageio=2.31.1=py38h06a4308_0
- importlib_resources=5.12.0=pyhd8ed1ab_0
- intel-openmp=2023.1.0=hdb19cb5_46305
- ipython=8.12.0=py38h06a4308_0
- jedi=0.18.1=py38h06a4308_1
- jpeg=9e=h5eee18b_1
- kiwisolver=1.4.4=py38h6a678d5_0
- krb5=1.20.1=h143b758_1
- lame=3.100=h7f98852_1001
- lazy_loader=0.2=py38h06a4308_0
- lcms2=2.12=h3be6417_0
- ld_impl_linux-64=2.38=h1181459_1
- lerc=3.0=h295c915_0
- libblas=3.9.0=1_h86c2bf4_netlib
- libbrotlicommon=1.0.9=h166bdaf_7
- libbrotlidec=1.0.9=h166bdaf_7
- libbrotlienc=1.0.9=h166bdaf_7
- libcblas=3.9.0=5_h92ddd45_netlib
- libclang=10.0.1=default_hb85057a_2
- libdeflate=1.17=h5eee18b_0
- libedit=3.1.20221030=h5eee18b_0
- libevent=2.1.12=hdbd6064_1
- libfaiss=1.7.1=h2bc3f7f_1_cpu
- libfaiss-avx2=1.7.1=h1234567_1_cpu
- libffi=3.4.4=h6a678d5_0
- libgcc-ng=11.2.0=h1234567_1
- libgfortran-ng=11.2.0=h00389a5_1
- libgfortran5=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- liblapack=3.9.0=5_h92ddd45_netlib
- libllvm10=10.0.1=he513fc3_3
- libopenblas=0.3.20=pthreads_h78a6416_0
- libopus=1.3.1=h7f98852_1
- libpng=1.6.39=h5eee18b_0
- libpq=12.15=hdbd6064_1
- libprotobuf=3.20.3=he621ea3_0
- libstdcxx-ng=11.2.0=h1234567_1
- libtiff=4.5.0=h6a678d5_2
- libvpx=1.7.0=h439df22_0
- libwebp=1.2.4=h11a3e52_1
- libwebp-base=1.2.4=h5eee18b_1
- libxcb=1.15=h7f8727e_0
- libxkbcommon=1.0.1=hfa300c1_0
- libxml2=2.9.14=h74e7548_0
- libxslt=1.1.35=h4e12654_0
- locket=1.0.0=py38h06a4308_0
- lz4-c=1.9.4=h6a678d5_0
- matplotlib=3.7.1=py38h578d9bd_0
- matplotlib-base=3.7.1=py38h417a72b_1
- matplotlib-inline=0.1.6=py38h06a4308_0
- mkl=2023.1.0=h6d00ec8_46342
- mkl-service=2.4.0=py38h5eee18b_1
- munkres=1.1.4=pyh9f0ad1d_0
- ncurses=6.4=h6a678d5_0
- nettle=3.6=he412f7d_0
- networkx=2.8.4=py38h06a4308_1
- ninja=1.10.2=h06a4308_5
- ninja-base=1.10.2=hd09550d_5
- nspr=4.35=h6a678d5_0
- nss=3.89.1=h6a678d5_0
- numpy=1.22.3=py38h99721a1_2
- openblas=0.3.20=pthreads_h320a7e8_0
- openh264=2.1.1=h4ff587b_0
- openjpeg=2.4.0=h3ad879b_0
- openssl=3.0.9=h7f8727e_0
- packaging=23.0=py38h06a4308_0
- parso=0.8.3=pyhd3eb1b0_0
- partd=1.2.0=pyhd3eb1b0_1
- pcre=8.45=h9c3ff4c_0
- pexpect=4.8.0=pyhd3eb1b0_3
- pickleshare=0.7.5=pyhd3eb1b0_1003
- pillow=9.4.0=py38h6a678d5_0
- pip=23.1.2=py38h06a4308_0
- pixman=0.40.0=h36c2ea0_0
- ply=3.11=py_1
- prompt-toolkit=3.0.36=py38h06a4308_0
- ptyprocess=0.7.0=pyhd3eb1b0_2
- pure_eval=0.2.2=pyhd3eb1b0_0
- pycparser=2.21=pyhd3eb1b0_0
- pygments=2.15.1=py38h06a4308_1
- pyopenssl=23.0.0=py38h06a4308_0
- pyparsing=3.1.0=pyhd8ed1ab_0
- pyqt=5.15.7=py38h6a678d5_1
- pyqt5-sip=12.11.0=py38h6a678d5_1
- pysocks=1.7.1=py38h06a4308_0
- python=3.8.16=h955ad1f_4
- python-dateutil=2.8.2=pyhd8ed1ab_0
- python-lmdb=1.4.1=py38h6a678d5_0
- python_abi=3.8=2_cp38
- pytorch=1.12.1=py3.8_cuda11.3_cudnn8.3.2_0
- pytorch-mutex=1.0=cuda
- pywavelets=1.4.1=py38h5eee18b_0
- pyyaml=6.0=py38h5eee18b_1
- qt-main=5.15.2=h327a75a_7
- qt-webengine=5.15.9=hd2b0992_4
- qtwebkit=5.212=h4eab89a_4
- readline=8.2=h5eee18b_0
- requests=2.29.0=py38h06a4308_0
- scikit-image=0.20.0=py38h6a678d5_0
- setuptools=67.8.0=py38h06a4308_0
- sip=6.6.2=py38h6a678d5_0
- six=1.16.0=pyh6c4a22f_0
- sqlite=3.41.2=h5eee18b_0
- stack_data=0.2.0=pyhd3eb1b0_0
- tbb=2021.8.0=hdb19cb5_0
- tifffile=2020.10.1=py38hdd07704_2
- tk=8.6.12=h1ccaba5_0
- toml=0.10.2=pyhd8ed1ab_0
- toolz=0.12.0=py38h06a4308_0
- torchvision=0.13.1=py38_cu113
- tornado=6.1=py38h0a891b7_3
- traitlets=5.7.1=py38h06a4308_0
- typing-extensions=4.6.3=py38h06a4308_0
- typing_extensions=4.6.3=py38h06a4308_0
- urllib3=1.26.16=py38h06a4308_0
- wcwidth=0.2.5=pyhd3eb1b0_0
- wheel=0.38.4=py38h06a4308_0
- x264=1!157.20191217=h7b6447c_0
- xz=5.4.2=h5eee18b_0
- yaml=0.2.5=h7b6447c_0
- zipp=3.15.0=pyhd8ed1ab_0
- zlib=1.2.13=h5eee18b_0
- zstd=1.5.5=hc292b87_0
- pip:
- dlib==19.21.0
- opencv-python==4.5.3.56
- scipy==1.7.0
- tqdm==4.61.2
- wget==3.2
prefix: /root/anaconda3/envs/dk
1 cd workspace/DualStyleGAN/
2 conda init bash
3 source ~/.bashrc
4 ls
5 conda env create -f ../dk_env05.yml
6 conda info -e
7 conda env create -f ../dk_env05.yml
8 conda activate dk
9 conda list
10 conda install ../pytorch-1.12.1-py3.8_cuda11.3_cudnn8.3.2_0.tar.bz2
11 conda install ../torchvision-0.13.1-py38_cu113.tar.bz2
12 conda list
13 python destylize.py kingdom --model_path ./checkpoint/kingdom/ --model_name finetune-000600.pt
14 python destylize.py kingdom --model_path ./checkpoint --model_name finetune-000600.pt
15 torchrun --nproc_per_node=1 --master_port=8765 finetune_dualstylegan.py --iter 1500 --batch 2 --ckpt ./checkpoint/generator-pretrain.pt --style_loss 0.25 --CX_loss 0.25 --perc_loss 1 --id_loss 1 --L2_reg_loss 0.015 --augment kingdom
16 python generate.py --style kingdom --name kingdom_generate
17 conda install faiss==1.7.1
18 conda config --append channels pytorch
19 conda config --append channels conda-forge
20 conda install faiss==1.7.1
21 python generate.py --style kingdom --name kingdom_generate
22 conda install ../pytorch-1.12.1-py3.8_cuda11.3_cudnn8.3.2_0.tar.bz2
23 python generate.py --style kingdom --name kingdom_generate
24 history > history_0628.txt
25 conda env export -n dk > dk_env06.yml
26 python style_transfer.py --content ./data/content/019706.jpg --align_face --preserve_color --style kingdom --name kingdom_transfer --style_id 2 --weight 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 1 1 1 1 1 1 1
27 pip list
28 pip install --no-cache-dir dlib==19.21.0
29 conda env export -n dk > dk_env06.yml
30 python style_transfer.py --content ./data/content/019706.jpg --align_face --preserve_color --style kingdom --name kingdom_transfer --style_id 2 --weight 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 1 1 1 1 1 1 1
31 pip install --no-cache-dir wget==3.2
32 python style_transfer.py --content ./data/content/019706.jpg --align_face --preserve_color --style kingdom --name kingdom_transfer --style_id 2 --weight 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 1 1 1 1 1 1 1
33 python style_transfer.py --content ./data/content/019706.jpg --align_face --preserve_color --style kingdom --name kingdom_transfer --style_id 10 --weight 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 1 1 1 1 1 1 1
34 python style_transfer.py --content ./data/content/019706.jpg --align_face --preserve_color --style kingdom --name kingdom_transfer --style_id 10 --weight 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
35 python style_transfer.py --content ./data/content/019706.jpg --align_face --preserve_color --style kingdom --name kingdom_transfer --style_id 6 --weight 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
36 python style_transfer.py --content ./data/content/unsplash.jpg --align_face --preserve_color --style kingdom --name kingdom_transfer --style_id 13 --weight 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
37 python style_transfer.py --content ./data/content/unsplash.jpg --align_face --preserve_color --style kingdom --name kingdom_transfer --style_id 13 --weight 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
38 python style_transfer.py --content ./data/content/unsplash.jpg --align_face --preserve_color --style kingdom --name kingdom_transfer --style_id 11 --weight 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
39 python style_transfer.py --content ./data/content/unsplash.jpg --align_face --preserve_color --style kingdom --name kingdom_transfer --style_id 22 --weight 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
40 python style_transfer.py --content ./data/content/unsplash.jpg --align_face --preserve_color --style kingdom --name kingdom_transfer --style_id 22 --weight 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2
41 conda env export -n dk > dk_env06.yml
42 history > history_0628.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment