Giter Club home page Giter Club logo

Comments (8)

vince62s avatar vince62s commented on August 25, 2024

What is the performance impact ?

from ctranslate2.

guillaumekln avatar guillaumekln commented on August 25, 2024

The goal would be to maintain the same level of performance.

I'm not sure how the TopK from TensorRT compares to other implementation, such as the one from PyTorch. I used it because it was the easiest to integrate.

from ctranslate2.

guillaumekln avatar guillaumekln commented on August 25, 2024

Possible reference implementations:

from ctranslate2.

guillaumekln avatar guillaumekln commented on August 25, 2024

Looks like the 2 candidates mentioned above are significantly slower than TensorRT's TopK. We might not be able to easily get rid of TensorRT.

from ctranslate2.

vince62s avatar vince62s commented on August 25, 2024

do you have numbers? good to know though.

from ctranslate2.

guillaumekln avatar guillaumekln commented on August 25, 2024

Yes.

Here are some execution times of the TopK layer with K = 4 and an input with shape [32, 4 * 32000] (a typical input shape during batched beam search):

TopK implementation Execution time (ms)
TensorRT 0.233461
ONNX Runtime 1.55496
PyTorch 2.78814

Here are some tokens/s when running a CTranslate2 translation with batch = 32 and beam = 4:

TopK implementation Translation throughput (tokens/s)
TensorRT 1969.13
ONNX Runtime 1848.19
PyTorch 1790.37

Given the poor result of PyTorch's TopK, we could think I did something wrong during the integration. That's possible. However, there are some open issues on the PyTorch repository regarding the poor TopK performance.

from ctranslate2.

vince62s avatar vince62s commented on August 25, 2024

I don't get how we can have an order of magnitude in the first table vs a few % differences in the second.

from ctranslate2.

guillaumekln avatar guillaumekln commented on August 25, 2024

The TopK layer only accounts for a few % of the total runtime. That's why the impact appears smaller when running a full translation.

from ctranslate2.

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.