Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

torchdiffeq odeint.py is no longer compatible with pytorch==1.3.1 #1

Open
VaiSuliafu opened this issue Jun 9, 2021 · 1 comment
Open

Comments

@VaiSuliafu
Copy link

``Hi,

After setting up my environment as indicated on the README, I discovered torchdiffeq._impl.odeint.py contains the following import:

from torch.autograd.functional import vjp

However, torch.autograd.functional doesn't exist in pytorch 1.3.1.

Then, updating torch and torchvision to their latest versions results in the following error:

Traceback (most recent call last): File "run.py", line 137, in <module> oderl.train_env_model(num_iters=args.iters) File "/root/repos/mbrl-smdp-ode/mbrl.py", line 161, in train_env_model train=True) File "/root/repos/mbrl-smdp-ode/model.py", line 581, in compute_loss self.predict_next_states(traj_cur_states, actions, time_steps, lengths, train=train) File "/root/repos/mbrl-smdp-ode/model.py", line 563, in predict_next_states train=train) # [N, T+1, D_latent] File "/root/repos/mbrl-smdp-ode/model.py", line 508, in encode_latent_traj means_z0, logvars_z0 = self.encoder_z0(torch.cat((states, actions), dim=-1), time_steps, lengths) File "/root/miniconda3/envs/mbrl_env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/root/repos/mbrl-smdp-ode/model.py", line 78, in forward data_packed = pack_padded_sequence(data, lengths, batch_first=True, enforce_sorted=False) File "/root/miniconda3/envs/mbrl_env/lib/python3.6/site-packages/torch/nn/utils/rnn.py", line 245, in pack_padded_sequence _VF._pack_padded_sequence(input, lengths, batch_first) RuntimeError: 'lengths' argument should be a 1D CPU int64 tensor, but got 1D cuda:0 Long tensor (mbrl_env) root@insideDocker:~/repos/mbrl-smdp-ode#

Can anyone help resolve this? Trying to reproduce the results of this paper for baseline measurements of some new work :)

@mqjinwon
Copy link

mqjinwon commented Nov 9, 2021

I got the same problem, and I changed the PyTorch version to 1.7.0. It works to me.

here's my conda environment file

name: mbrl
channels:

  • defaults
    dependencies:
  • _libgcc_mutex=0.1=main
  • _openmp_mutex=4.5=1_gnu
  • ca-certificates=2021.7.5=h06a4308_1
  • certifi=2021.5.30=py36h06a4308_0
  • libedit=3.1.20210714=h7f8727e_0
  • libffi=3.2.1=hf484d3e_1007
  • libgcc-ng=9.3.0=h5101ec6_17
  • libgomp=9.3.0=h5101ec6_17
  • libstdcxx-ng=9.3.0=hd4cf53a_17
  • ncurses=6.2=he6710b0_1
  • openssl=1.1.1l=h7f8727e_0
  • pip=21.2.2=py36h06a4308_0
  • python=3.6.7=h0371630_0
  • readline=7.0=h7b6447c_5
  • setuptools=58.0.4=py36h06a4308_0
  • sqlite=3.33.0=h62c20be_0
  • tk=8.6.11=h1ccaba5_0
  • wheel=0.37.0=pyhd3eb1b0_1
  • xz=5.2.5=h7b6447c_0
  • zlib=1.2.11=h7b6447c_3
  • pip:
    • cffi==1.14.6
    • cloudpickle==2.0.0
    • cycler==0.10.0
    • cython==0.29.24
    • dataclasses==0.8
    • fasteners==0.16.3
    • future==0.18.2
    • glfw==2.3.0
    • gym==0.20.0
    • imageio==2.9.0
    • kiwisolver==1.3.1
    • matplotlib==3.3.4
    • mujoco-py==2.0.2.13
    • numpy==1.19.5
    • pillow==8.3.2
    • pycparser==2.20
    • pyparsing==2.4.7
    • python-dateutil==2.8.2
    • scipy==1.4.0
    • six==1.16.0
    • torch==1.7.0
    • torchvision==0.8.0
    • typing-extensions==3.10.0.2
    • torchdiffeq==0.2.2
      prefix: "your anaconda environment path"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants