allenai / savn

Learning to Learn how to Learn: Self-Adaptive Visual Navigation using Meta-Learning (https://arxiv.org/abs/1812.00971)
Apache License 2.0
185 stars 56 forks source link

Minor change to work in pytorch 1.8.1 #26

Closed zkytony closed 3 years ago

zkytony commented 3 years ago

I just set up this repository following the README docs. The evaluation scripts for Scene Priors and Non-Adaptive A3C worked, but not for SAVN. Because pytorch 0.4.1 is out of date, I tried with 1.8.1. I needed to change nn._VF.lstm_cell to torch._VF.lstm_cell. Then it worked. Just posting this here in case anyone runs into this issue.

The following code also works (replace the torch._VF call:

lstm_cell = nn.quantizable.LSTMCell.from_params(params["lstm.weight_ih"],
                                                params["lstm.weight_hh"],
                                                bi=params["lstm.bias_ih"],
                                                bh=params["lstm.bias_hh"])
hx, cx = lstm_cell(embedding, prev_hidden)
YunlianMoon commented 2 years ago

Hi,

Do you succeed to train their models?

I tried to train their SAVN model, but I might have been stuck in the environments settings (e.g. python, torch, torchvision versions). I always met some errors when I ran their codes for training.

zkytony commented 2 years ago

Yes, I was able to run training and evaluation scripts for savn. But I didn't end up using this method as a baseline. I found it difficult to get this to work on the newer version of Ai2thor (3.3.4), because this codebase requires precomputed resnet features. The existing trained model (trained on ai2thor 1.0.0) doesn't work well with images from the new version.

YunlianMoon commented 2 years ago

Would you mind giving me the package versions you use to train their models? (maybe you can run conda list or pip list to obtain the information)

It is impossible to install torch==0.4.1 now, and I install PyTorch using: conda install pytorch==1.8.1 torchvision==0.9.1 torchaudio==0.8.1 cudatoolkit=10.2 -c pytorch. However I met some errors.

zkytony commented 2 years ago

This is I believe the state of pytorch packages when I was working on this:

$ pip list | grep torch
efficientnet-pytorch        0.6.3
pytorch-lightning           1.3.8
segmentation-models-pytorch 0.2.0
torch                       1.9.0+cu111
torchaudio                  0.9.0
torchmetrics                0.4.1
torchvision                 0.10.0+cu111
YunlianMoon commented 2 years ago

Thanks for your information! I have run their codes successfully now.

zkytony commented 2 years ago

@YunlianMoon Glad it helped!