IntelLabs / bayesian-torch

A library for Bayesian neural network layers and uncertainty estimation in Deep Learning extending the core of PyTorch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pytorch version issue

hebowei2000 opened this issue · comments

Hi, it seems that this software only supports Pytorch 1.8.1 LTS or newer version. When I try to use this code in my own project(which is mainly based on Pytorch 1.4.0), some conflicts occur and seemingly unavoidable. Could you please update this software to make it also support some older version Pytorch, for example, 1.4.0. Great Thanks!!!

Hi @hebowei2000, can you please give details on the conflicts that you are observing with PyTorch 1.4.0?

Thanks! For example, when I use LinearReparameterization class to build a q function neural network in the SAC algorithm, I met an error like this. When I update my Pytorch to 1.8.1 LTS, this error disappears. But some of my former programs only support Pytorch 1.4.0. So directly updating Pytorch to 1.8.1 is not a good idea for me actually.
"Traceback (most recent call last):
File "bayesian_mujoco_new.py", line 217, in
experiment(variant)
File "bayesian_mujoco_new.py", line 49, in experiment
posterior_rho_init=posterior_rho_init,
File "/nfs/project/mingyue/bayesian-torch/bayesian_torch/layers/variational_layers/linear_variational.py", line 90, in init
persistent=False)
TypeError: register_buffer() got an unexpected keyword argument 'persistent'"

@hebowei2000 , Thanks for the details. We introduced this to avoid saving the buffers in the model checkpoint to reduce the model size, as these buffers are not required after the model is trained (ref commit: 09b8d0a).
A simple fix to your issue to make backward compatible to PyTorch 1.4.0 is to remove the "persistent=False" from all the variational layer definitions (undo commit 09b8d0a changes). I hope this helps!

@ranganathkrishnan Great thanks! The issue has been resolved perfectly.