I am Charmie

メモとログ

PyTorch

hydra

hydraは階層構造を持つ設定を扱うためのPythonフレームワーク このサンプルが分かりやすい 設定を外部ファイル(yaml形式)として保持 メインプログラムは設定ファイルを読み込んで,インスタンスを生成 このjupyter notebookを見ると,設定ファイルを読み込…

PyTorch and GPyTorch on Windows

改めてWindowsはクソ. 手順としては,以下のようにインストールしていく. cuDNNのインストールディレクトリを環境変数に設定しなくてもPyTorchのサンプルプログラムは動いたけど,本当に大丈夫なのかは謎. NVIDIA Driverのインストール NVIDIA Driverを最…

PyTorch 1.9.0 on Ubuntu 20.04

ここを参考にして,以下の構成でCUDA, gpytorch, botorch, axのインストールに成功 nvidia-driver: 470 CUDA: 11.1 cuDNN: 8.20 PyTorch: 1.9.0の組み合わせ GPyTorch: botorch: 0. バックアップ timeshiftをインストールして,システムバックアップを取る.…

Anaconda's channel priority

Summary about Anaconda's channel priority to avoid unexpected version change of some packages manage channel priority by conda config --add/--prepend/--append channels new_channel -. You can check the official information here The problem …

PyTorch 1.0 with CUDA 10.0 and cuDNN 7.5 on Ubuntu 18.04

This post describes how to setup PyTorch 1.0 with CUDA 10.0 and cuDNN 7.5 on Ubuntu 18.04. Step 0 uninstall CUDA 10.1 related components# uninstall PyTorchconda uninstall pytorch torchvision cudatoolkit# uninstall cuDNNsudo dpkg -r libcudn…

PyTorch 1.0 on Ubuntu 18.04

The official site provides conda package with the combination of CUDA toolkit 10.0 and cuDNN 7.4. My installation is CUDA toolkit 10.1 and cuDNN 7.5.After the installation, a sample program worked, however I may need to downgrade the toolk…

PyTorch: visualize trained filters and feature maps

I just wrote a simple code to visualize trained filters and feature maps of pytorch. For simplicity, the below code uses pretrained AlexNet but the code must work with any network with Conv2d layers. [code lang="python"] !/usr/bin/env pyth…

PyTorch: fine-tune a pre-trained model

See the tutorial. Important note: torchvision provides several pre-trained models with their trained parameters. AlexNet, DenseNet, Inception, ResNet, VGG are available, see here. With pretrained=True, pre-trained parameters are available.…

PyTorch: at evaluation/test phase

I got a runtime error at evaluation phase of my simple siamese network as RuntimeError: cuda runtime error (2) : out of memory at the line of executing forward pass. Some comments on stackoverflow suggests to define x and y with volatile=T…

PyTorch: AutoGrad

See this tutorial. Set requires_grad=True for all tensors we compute gradients w.r.t. them. [code lang='python'] input and output x = torch.randn(N, D_in, device=device, dtype=dtype) y = torch.randn(N, D_out, device=device, dtype=dtype) pa…

PyTorch: define a neural network

See the tutorial. It's quite simple (Keras provides simpler interface though). A neural network is defined as a class that has a forward function. The forward function defines how input data is processed through the network. PyTorch automa…

PyTorch: installation

Super easy installation GUI on the web as below