Git Product home page Git Product logo

Comments (8)

davidmascharka avatar davidmascharka commented on July 22, 2024

Could you let us know which version of PyTorch you're running and what version of our code you have?

Note: I updated your comment to use triple-backticks so the line breaks in your code blocks are displayed properly.

from tbd-nets.

bidongqinxian avatar bidongqinxian commented on July 22, 2024

thank you for your reply! I use PyTorch v0.3.0 and python3.5, the code is the latest you put on github. and I extract the images and questions feature by using this instructions, I got 2 h5 files about val.

from tbd-nets.

davidmascharka avatar davidmascharka commented on July 22, 2024

The latest version of master was rewritten to run in PyTorch 0.4, which unfortunately broke compatibility with v0.3 and earlier. If you git checkout tags/torch0.3 then the code should run. There's a note buried in our README but it's a bit hard to find.

Alternatively, upgrading to PyTorch 0.4 has many niceties that are worth the upgrade. The PyTorch API has also stabilized and is not expected to change dramatically.

from tbd-nets.

bidongqinxian avatar bidongqinxian commented on July 22, 2024

I upgrade my pytorch to 0.4, and the old problem disappear,but new problem came like that

Generating programs...
/home/dengwei/tbd-nets/utils/generate_programs.py:261: UserWarning: volatile was removed and now has no effect. Use `with torch.no_grad():` instead.
  volatile=True)
Traceback (most recent call last):
  File "eval.py", line 17, in <module>
    dest_dir=Path('data/val'), batch_size=128)
  File "/home/dengwei/tbd-nets/utils/generate_programs.py", line 263, in generate_programs
    programs_pred = program_generator.reinforce_sample(questions_var)
  File "/home/dengwei/tbd-nets/utils/generate_programs.py", line 137, in reinforce_sample
    y[:, t][not_done] = cur_output_data[not_done]
RuntimeError: expand(torch.LongTensor{[128, 1]}, size=[128]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)

so, the batchsize is not right?but I change the batchsize the error still exist. could u give me some advice to solve it?

from tbd-nets.

davidmascharka avatar davidmascharka commented on July 22, 2024

Are you on the latest master? That line that's failing should actually be

y[:, t][not_done] = cur_output_data[not_done][0]

and it looks like your file is missing that [0] at the end. This should be line 132 of utils/generate_programs.py

from tbd-nets.

davidmascharka avatar davidmascharka commented on July 22, 2024

@bidongqinxian did this fix the issue?

from tbd-nets.

bidongqinxian avatar bidongqinxian commented on July 22, 2024

yes, I downloaded the former master and now I update the latest master.But unfortunately, other error came out as:

Traceback (most recent call last):
  File "eval.py", line 72, in <module>
    outputs = tbd_net(feats, programs)
  File "/home/dengwei/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/dengwei/tbd-nets/tbd/module_net.py", line 195, in forward
    output = module(feat_input, output)
  File "/home/dengwei/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/dengwei/tbd-nets/tbd/modules.py", line 92, in forward
    attended_feats = torch.mul(feats, attn.repeat(1, self.dim, 1, 1))
RuntimeError: The size of tensor a (128) must match the size of tensor b (16384) at non-singleton dimension 1

did I miss something? thanks for your advice.@davidmascharka

from tbd-nets.

davidmascharka avatar davidmascharka commented on July 22, 2024

Since that fixes the original issue here I'm going to close this.

Without seeing your eval.py file I really can't say where the error is coming from. It looks like something is getting reshaped incorrectly or the batch is malformed. Feel free to open another issue and post that code if you're unable to diagnose from there.

from tbd-nets.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.