Chadrick's Blog

  • Posts

April 2020

pytorch

avoiding full gpu memory occupation during training in pytorch

Problem While training even a small model, I found that the gpu memory occupation neary reached 100%. This seemed odd and it made me to presume that my pytorch training code was not handling gpu memory management properly. Here is a pseudo code for my pytorch training script. With this Read more…

By chadrick_author, 3 years2 years ago
pytorch

pytorch ckpt loading error due to device mismatch

Problem I have trained and saved model checkpoint which was train in GPU 1. However, when I try to load the checkpoint in GPU 0, it fails. The following is my ckpt loading code: this gives me the following error: Solution when loading ckpt data, ensure that device is mapped Read more…

By chadrick_author, 3 years ago
web

serving static files in subpath of domain in django

Problem My django project structure looks like this.(only showing files relevant to this problem) As you can see, there are two static dirs that has to be served: ‘prj/app/static/and ‘prj/static. When serving this project from the root of a domain such as ‘localhost:8000’, the following configuration for static files in Read more…

By chadrick_author, 3 years3 years ago
deep learning

applying xavier normal initialization to conv/linear layer(module) in pytorch

in tensorflow, default initialization used is glorot normal initialization which is also known as xavier normal initialization. To use the same setting in pytorch, the following practice should be done. 2d convolution module example linear module example pytorch supports other initialization functions, and one can use those initialization functions in Read more…

By chadrick_author, 3 years2 years ago
deep learning

how to manually change weight/bias in torch module

Problem an LSTM module will be used as an example. Assume a simple net that includes an LSTM module. According to the docs, the weight and bias can be accessed by weight_ih_l[k], weight_hh_l[k], bias_ih_l[k], bias_hh_l[k]. For this example, I want to set the b_if to one. So, I could do Read more…

By chadrick_author, 3 years3 years ago
deep learning

reasons why forget bias initialized to 1 is good practice in lstm

https://github.com/pytorch/pytorch/issues/20102 also mentioned in tensorflow docs: https://www.tensorflow.org/api_docs/python/tf/keras/layers/LSTM

By chadrick_author, 3 years3 years ago
python

python script to convert dir or file of image to png

here is a simple code to convert dir/file of images to png in batch. for installing imagemagick, use this command:

By chadrick_author, 3 years ago
Recent Posts
  • fix blank plot when using plotly in jupyter lab
  • pylance stuck on “Searching for source files”
  • paper review: “Graph Attention Networks”
  • fix “Certificate verification failed” error in apt update of docker container
  • fixing “Could not handshake: An unexpected TLS packet was received” error while apt update in docker container behind corporate proxy
Categories
  • algorithm
  • c/c++
  • cuda
  • data science
  • deep learning
  • error fix
  • kicad
  • kotlin
  • linux
  • postgres
  • python
  • pytorch
  • tensorflow
  • Uncategorized
  • web
Recent Comments
  • Eric on fix ‘certificate apiserver-kubelet-client not signed by CA certificate ca: crypto/rsa: verification error’ error during minikube start
  • Anonymous on qtwindeploy output missing ‘libgcc_s_seh-1.dll’ error fix
  • Andrew Mellinger on python implementation of rotating caliper algorithm
  • minhln14 on get rotation angle between two vectors
  • Anonymous on fix ‘certificate apiserver-kubelet-client not signed by CA certificate ca: crypto/rsa: verification error’ error during minikube start
Archives
  • September 2022
  • July 2022
  • June 2022
  • May 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • February 2019
  • January 2019
  • December 2018
  • November 2018
Meta
  • Register
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
  • Posts
Hestia | Developed by ThemeIsle