Q&A
最終的にはAnaconda Navigator から起動したJupyter Labでtensorflow-gpuを使いたいと思っています。
環境は以下のとおりです。
Windows 10 (RTX2060Super搭載)
Microsoft Visual Studio 2019
Nvidia CUDA 11.6
Anaconda3.9
ここからAnacondaプロンプトを用いて以下のようにインストールを試みました。
Anacondaプロンプト
1> conda create -n twne 2> conda activate twne 3(twne)> conda install python=3.6.10 4(twne)> pip3 install torch==1.10.1+cu113 torchvision==0.11.2+cu113 torchaudio===0.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html 5(twne)> conda install tensorflow-gpu=1.14 6(twne)> nvcc -V 7nvcc: NVIDIA (R) Cuda compiler driver 8Copyright (c) 2005-2021 NVIDIA Corporation 9Built on Fri_Dec_17_18:28:54_Pacific_Standard_Time_2021 10Cuda compilation tools, release 11.6, V11.6.55 11Build cuda_11.6.r11.6/compiler.30794723_0 12(twne)>nvidia-smi 13Sat Jan 29 17:04:27 2022 14+-----------------------------------------------------------------------------+ 15| NVIDIA-SMI 456.71 Driver Version: 456.71 CUDA Version: 11.1 | 16|-------------------------------+----------------------+----------------------+ 17| GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC | 18| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | 19|===============================+======================+======================| 20| 0 GeForce RTX 206... WDDM | 00000000:08:00.0 On | N/A | 21| 29% 30C P8 19W / 175W | 1502MiB / 8192MiB | 11% Default | 22+-------------------------------+----------------------+----------------------+ 23 24+-----------------------------------------------------------------------------+ 25| Processes: | 26| GPU GI CI PID Type Process name GPU Memory | 27| ID ID Usage | 28|=============================================================================| 29| 0 N/A N/A 1424 C+G Insufficient Permissions N/A | 30| 0 N/A N/A 2208 C+G ...8wekyb3d8bbwe\Cortana.exe N/A | 31| 0 N/A N/A 7796 C+G C:\Windows\explorer.exe N/A | 32| 0 N/A N/A 8740 C+G ...5n1h2txyewy\SearchApp.exe N/A | 33| 0 N/A N/A 10004 C+G ...i\Application\vivaldi.exe N/A | 34| 0 N/A N/A 10256 C+G ...cw5n1h2txyewy\LockApp.exe N/A | 35| 0 N/A N/A 10872 C+G Insufficient Permissions N/A | 36| 0 N/A N/A 11724 C+G ...nputApp\TextInputHost.exe N/A | 37| 0 N/A N/A 12424 C+G ...lPanel\SystemSettings.exe N/A | 38| 0 N/A N/A 14316 C+G ...llpaper\RainWallpaper.exe N/A | 39| 0 N/A N/A 14568 C+G ...inWallpaper\videocore.exe N/A | 40| 0 N/A N/A 14576 C+G ...inWallpaper\videocore.exe N/A | 41| 0 N/A N/A 15348 C+G ...ram Files\LGHUB\lghub.exe N/A | 42| 0 N/A N/A 16256 C+G ...aming\Spotify\Spotify.exe N/A | 43| 0 N/A N/A 16908 C+G ...4.0.3.0\GoogleDriveFS.exe N/A | 44| 0 N/A N/A 18548 C+G ...t\GoogleIMEJaRenderer.exe N/A | 45| 0 N/A N/A 19144 C+G ...ions\Sancan210\Sancan.exe N/A | 46| 0 N/A N/A 20204 C+G ...ekyb3d8bbwe\YourPhone.exe N/A | 47+-----------------------------------------------------------------------------+ 48(twne)>python 49Python 3.6.13 |Anaconda, Inc.| (default, Mar 16 2021, 11:37:27) [MSC v.1916 64 bit (AMD64)] on win32 50Type "help", "copyright", "credits" or "license" for more information. 51>>> from tensorflow.python.client import device_lib 52C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. 53 _np_qint8 = np.dtype([("qint8", np.int8, 1)]) 54C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. 55 _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) 56 ・ 57 ・ 58 ・ 59 (略) 60 ・ 61 ・ 62 ・ 63C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. 64 np_resource = np.dtype([("resource", np.ubyte, 1)]) 65>>> print(device_lib.list_local_devices()) 662022-01-29 17:12:54.466889: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2 67 ・ 68 ・ 69 ・ 70 (略) 71 ・ 72 ・ 73 ・ 742022-01-29 17:12:54.881165: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/device:GPU:0 with 6734 MB memory) -> physical GPU (device: 0, name: GeForce RTX 2060 SUPER, pci bus id: 0000:08:00.0, compute capability: 7.5) 75[name: "/device:CPU:0" 76device_type: "CPU" 77memory_limit: 268435456 78locality { 79} 80incarnation: 11278547066770496530 81, name: "/device:GPU:0" 82device_type: "GPU" 83memory_limit: 7061500724 84locality { 85 bus_id: 1 86 links { 87 } 88} 89incarnation: 16847822037550859714 90physical_device_desc: "device: 0, name: GeForce RTX 2060 SUPER, pci bus id: 0000:08:00.0, compute capability: 7.5" 91] 92>>> 93(twne)>
この状況で、Anaconda Navigator から起動したJupyter Labで以下のコードを実行しましたが失敗しました。
python(JupyterLab)
1%cd .\stylegan2 2from function import *
▶
python(JupyterLab)
1C:\Users\hoge\painter\stylegan2 2C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. 3 _np_qint8 = np.dtype([("qint8", np.int8, 1)]) 4C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. 5 _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) 6 ・ 7 ・ 8 ・ 9 (略) 10 ・ 11 ・ 12 ・ 13C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. 14 np_resource = np.dtype([("resource", np.ubyte, 1)]) 15Setting up TensorFlow plugin "fused_bias_act.cu": Preprocessing... Failed! 16--------------------------------------------------------------------------- 17RuntimeError Traceback (most recent call last) 18<ipython-input-1-5a9fc02cd5e9> in <module> 19 1 # 関数定義 20 2 get_ipython().run_line_magic('cd', '.\\stylegan2') 21----> 3 from function import * 22 23~\painter\stylegan2\function.py in <module> 24 8 25 9 tflib.init_tf() 26---> 10 _G, _D, Gs = pickle.load(open("../network-tadne.pkl", "rb")) 27 11 # _G = Instantaneous snapshot of the generator. Mainly useful for resuming a previous training run. 28 12 # _D = Instantaneous snapshot of the discriminator. Mainly useful for resuming a previous training run. 29 ・ 30 ・ 31 ・ 32 (略) 33 ・ 34 ・ 35 ・ 36~\painter\stylegan2\dnnlib\tflib\custom_ops.py in _run_cmd(cmd) 37 59 status = pipe.close() 38 60 if status is not None: 39---> 61 raise RuntimeError('NVCC returned an error. See below for full command line and output log:\n\n%s\n\n%s' % (cmd, output)) 40 62 41 63 def _prepare_nvcc_cli(opts): 42 43RuntimeError: NVCC returned an error. See below for full command line and output log: 44 45nvcc "C:\Users\hoge\painter\stylegan2\dnnlib\tflib\ops\fused_bias_act.cu" --preprocess -o "C:\Users\hoge\AppData\Local\Temp\tmpgwzv8k1u\fused_bias_act_tmp.cu" --keep --keep-dir "C:\Users\hoge\AppData\Local\Temp\tmpgwzv8k1u" --disable-warnings --include-path "C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorflow\include" --include-path "C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorflow\include\external\protobuf_archive\src" --include-path "C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorflow\include\external\com_google_absl" --include-path "C:\Users\hoge\anaconda3\envs\twne\lib\site-packages\tensorflow\include\external\eigen_archive" --compiler-bindir "C:/Program Files (x86)/Microsoft Visual Studio 14.0/vc/bin" 2>&1 46 47nvcc fatal : nvcc cannot find a supported version of Microsoft Visual Studio. Only the versions between 2017 and 2019 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
最後のメッセージを読むと『Visual Studioのバージョンが違うので2017か2019にしろ』と書かれていますが、Visual Studio 2019はインストール済みで、実際、他の仮想環境ではtensorflowではありませんが、GPUを利用したシステムが動いています。どうすればいいでしょうか?
回答1件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
2022/01/30 04:42
2022/01/30 07:13