GithubHelp home page GithubHelp logo

Comments (2)

TrungThanhTran avatar TrungThanhTran commented on July 30, 2024 2

I reduce the beam_size to 1 or 2 and I found out that it achieves the same result. However, I applied to an auto annotation problem which generates about 50 words at a time. I don't think you need to reduce it. Plus, I reduce the number of connections and layers of encoder and decoder, too. About the visual, yes, its outcome is the same as your output.

from meshed-memory-transformer.

svp19 avatar svp19 commented on July 30, 2024

@Trantony I found that the function expands visual (ie, repeats the tensor beam_size times) at the first step and for subsequent steps the visual fed as input is the same as the output of the function call.

Example:
If I feed in visual as a FloatTensor of size(4, 50, 2048) (b_s, seq_len, d_input) and beam_size=5 than self._expand_visual returns a FloatTensor of size (20, 50, 2048) (b_s * beam_size, seq_len, d_input) at the first step during beam search.

For subsequent steps of beam search, visual of shape (20, 50, 2048) , as expected, is fed as an argument to self._expand_visual and output tensor generated is the same as the input.

old_visual = visual
visual = self._expand_visual(visual, cur_beam_size, selected_beam)
print(torch.equal(old_visual, visual))
>> True

Did I miss out anything? Also, how did you intend to speed up beam search?

from meshed-memory-transformer.

Related Issues (20)

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.