0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ubuntu20 に stylegan2 をインストール(執筆中・失敗するかも)

0
Last updated at Posted at 2021-03-13

Ubuntu20 に stylegan2 をインストール(執筆中・失敗するかも)です。

ダウンロードするソフト

cuda10.1
CUDA Toolkit Archive | NVIDIA Developer

nvidia driver for cuda 10.1
NVIDIAドライバダウンロード

Anaconda
Anaconda | Individual Edition

インストールログ(途中)

# --------------------------------------------------------
# cuda 10.1 のインストール(やらないほうがいいかも)
# --------------------------------------------------------
# sudo apt install -y nvidia-cuda-toolkit
# nvcc --version

# --------------------------------------------------------
# NVIDIA GPU ドライバのインストール(やらないほうがいいかも)
# --------------------------------------------------------
# ubuntu-drivers devices
# sudo ubuntu-drivers autoinstall

# --------------------------------------------------------
# 手動で cuda 10.1 をインストール(やらないほうがいいかも)
# --------------------------------------------------------
# cd ~/Downloads/
# sudo apt install -y ./libcudnn8_8.0.5.39-1+cuda10.1_amd64.deb

# --------------------------------------------------------
# gcc 7 g++ 7 のインストールと有効化
# --------------------------------------------------------
sudo apt install -y gcc-7 g++-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 10

# --------------------------------------------------------
# dkms を使用して自前でドライバを構築インストール(試し中)
# --------------------------------------------------------
lsmod | grep -i nouveau
sudo gedit /etc/modprobe.d/blacklist-nouveau.conf
/etc/modprobe.d/blacklist-nouveau.conf
/etc/modprobe.d/blacklist-nouveau.conf
blacklist nouveau
options nouveau modeset=0
sudo update-initramfs -u
sudo apt install -y build-essential
sudo apt install -y dkms

chmod +x cuda_10.1.243_418.87.00_linux.run
sudo ./cuda_10.1.243_418.87.00_linux.run --silent --toolkit --no-opengl-libs

# for tesla k20c 
# https://www.nvidia.co.jp/content/DriverDownload-March2009/confirmation.php?url=/tesla/418.181.07/NVIDIA-Linux-x86_64-418.181.07.run&lang=jp&type=Tesla
chmod +x NVIDIA-Linux-x86_64-418.181.07.run
sudo ./NVIDIA-Linux-x86_64-418.181.07.run --silent --no-opengl-files --no-libglx-indirect --dkms

sudo reboot now

# --------------------------------------------------------
# Anaconda のインストール
# --------------------------------------------------------
cd ~/Downloads/
bash Anaconda3-2020.11-Linux-x86_64.sh
# source ~/.bashrc

# --------------------------------------------------------
# Anaconda の stylegan2 用構築
# --------------------------------------------------------
cd
conda create -n stylegan2 python==3.6.9
conda activate stylegan2
pip install -y scipy==1.3.3 requests==2.22.0 Pillow==6.2.1
pip install -y tensorflow-gpu==1.15.3

# --------------------------------------------------------
# stylegan2 のダウンロードとテスト
# --------------------------------------------------------
cd
git clone https://github.com/NVlabs/stylegan2.git
cd stylegan2/
nvcc test_nvcc.cu -o test_nvcc -run

# --------------------------------------------------------
# stylegan2 のサンプル起動
# --------------------------------------------------------

python run_generator.py style-mixing-example --network=gdrive:networks/stylegan2-car-config-a.pkl  --row-seeds=6,100,80,450,1200 --col-seeds=50,820,1700,300 --truncation-psi=1.0
conda activate stylegan2

python run_generator.py style-mixing-example --network=gdrive:networks/stylegan2-car-config-a.pkl  --row-seeds=6,100,80,450,1200 --col-seeds=50,820,1700,300 --truncation-psi=1.0

python run_generator.py generate-images --network=gdrive:networks/stylegan2-ffhq-config-f.pkl   --seeds=6600-6625 --truncation-psi=0.5
nvcc test_nvcc.cu -o test_nvcc -run

python run_generator.py generate-images --network=gdrive:networks/stylegan2-ffhq-config-f.pkl   --seeds=6600-6625 --truncation-psi=0.5
~~~

#### 参考リンク

- [Teslaのnvidiaドライバーの正しいインストール方法 - Qiita ](https://qiita.com/npkk/items/76ff8104f54a9dceccb1)
- [Ubuntu 16 / 18 に GTX 1080Ti / RTX2080 の ドライバとCUDAのインストール - Qiita]( https://qiita.com/sasayabaku/items/2323a2c501e58c0621b6)
- [stylegan2 – using docker image to set up environment | datafireball]( https://datafireball.com/2020/04/06/stylegan2-using-docker-image-to-set-up-environment/comment-page-1/)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?