Hi,
My code works fine with Pytorch 0.3.1. I used PyTorch to make a differentiable kinematics model in my recent conference paper. https://arxiv.org/pdf/1804.07873.pdf
However, when I upgrade to Pytorch 0.4.1, I get the following error:
File "trainer_convnet.py", line 697, in train_convnet
loss.backward()
File "/usr/local/lib/python2.7/dist-packages/torch/tensor.py", line 93, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/usr/local/lib/python2.7/dist-packages/torch/autograd/__init__.py", line 90, in backward
allow_unreachable=True) # allow_unreachable flag
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation
This only happens in my differentiable kinematics model. It’s annoying that my code would be compatible with an earlier version of PyTorch but not a later version. Also, from this error, I’m not sure how to debug my code. I plan on just using 0.3.1 going forward, but perhaps this problem would be of help to the PyTorch developers.
Further, I’ve got a problem with using PyTorch 0.3.1 conflicting with Keras. When I have PyTorch 0.4.1 installed, Keras works fine. When I have PyTorch 0.3.1 installed, I can’t import anything from Keras. I’d like to use Keras to import a VGG16 image extractor before my PyTorch kinematics network, but because of this issue I can’t. Keras gives the following error:
Traceback (most recent call last):
File "trainer_convnet.py", line 61, in <module>
from keras.applications.vgg16 import preprocess_input
File "/usr/local/lib/python2.7/dist-packages/keras/__init__.py", line 3, in <module>
from . import utils
File "/usr/local/lib/python2.7/dist-packages/keras/utils/__init__.py", line 6, in <module>
from . import conv_utils
File "/usr/local/lib/python2.7/dist-packages/keras/utils/conv_utils.py", line 9, in <module>
from .. import backend as K
File "/usr/local/lib/python2.7/dist-packages/keras/backend/__init__.py", line 89, in <module>
from .tensorflow_backend import *
File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 5, in <module>
import tensorflow as tf
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: dlopen: cannot load any more object with static TLS
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
If anyone has suggestions to these issues, I’d appreciate it.
Thanks,
Henry M. Clever