Giter Site home page Giter Site logo

关于运行速度的问题 about knn-box HOT 3 CLOSED

sxysxy avatar sxysxy commented on May 29, 2024
关于运行速度的问题

from knn-box.

Comments (3)

sxysxy avatar sxysxy commented on May 29, 2024

另外,pck-knn-mt将Key的维度从1024降低到64,我在同样软硬件条件下同样数据集,pck-knn-mt的inference,用时大约16s。Key从1024维降低到64维,对于KNN检索来说应该大幅度提高了性能,但是对总体性能的影响却不大。种种迹象表明,KNN检索并没有那么费时间。FAISS库本身也是非常非常优化的,不仅有GPU加速,而且对于检索算法也有非常好的优化....

from knn-box.

OwenNJU avatar OwenNJU commented on May 29, 2024

在KNNMT论文(也就是Vanilla KNNMT)里说,加入KNN检索之后,速度慢了有2两个数量级。

我用咱们KNNBOX,在一块RTX8000上,测试对IT领域翻译的速度(推理速度),按照Readme中的指令运行的。

Baseline (只用NMT):用时14.1s

Vanilla KNNMT : 用时17.7s

我注意到有基于原始KNNMT的代码的工作例如Revised-Key-KNNMT,在运行的时候,整个程序的整体GPU利用率只有25%,作者说因为“检索数据库时,需要把向量先转移到CPU,检索得到表示后再转移到GPU",但我观察https://github.com/NJUNLP/knn-box/blob/master/knnbox/retriever/utils.py 似乎也是这样做的,运行Vanilla KNNMT GPU占用率却能够稳定接近100%。原始的KNNMT的代码https://github.com/urvashik/knnmt 是否存在GPU利用率过低的问题?(我实在没能跑起来这个原始的KNNMT代码,不知道HOME环境变量应该设置为什么,只能厚着脸皮来这里问问了)。

如果原始KNNMT比Baseline慢了两个数量级是因为原始KNNMT代码做的优化不好,而像KNNBOX这样能100%利用GPU则不存在这个问题的话,那么有关KNNMT的加速的研究还有用吗....

你好,谢谢你对kNN-BOX的关注。kNN-BOX确实在实现上优化了kNN-MT的解码效率问题,但是我们也注意到在解码过程中设置batch size比较大时,kNN-MT和单纯的neural模型还是会存在一定速度差异的。

from knn-box.

sxysxy avatar sxysxy commented on May 29, 2024

好的!!!

from knn-box.

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.