Giter Site home page Giter Site logo

Comments (4)

ZhaoQianfeng avatar ZhaoQianfeng commented on June 11, 2024

不好意思,我的问题,pad_mask不需要你手动设置,这是我昨天更新版本时留的一个bug。等会我重新检查一遍脚本后,会更新代码,预计下午5点以前,到时候你pull一下新代码就行 @17freeman

from knn-box.

ZhaoQianfeng avatar ZhaoQianfeng commented on June 11, 2024

@17freeman 嗨,代码已经更新了。我看你贴的命令里,在生成vanilla_knn_mt的datastore时使用了adaptive_knn_mt@transformer_wmt19_de_en这个arch, 虽然这样也可以(adaptive kNN-MT和vanilla kNN-MT生成的datastore一样),但生成vanilla datastore时比较推荐用vanilla_knn_mt@transformer_wmt19_de_en这个arch,理解起来比较统一

from knn-box.

17freeman avatar 17freeman commented on June 11, 2024

学长,在build_faiss_index这一步,faiss.index_cpu_to_gpu(),出现了faiss::gpu::StandardGpuResourcesImpl::allocMemory(const struct faiss::gpu::AllocRequest &) at D:\bld\faiss-split_1667330512241\work\faiss\gpu\StandardGpuResources.cpp:452: Error: 'err == cudaSuccess' failed: StandardGpuResources: alloc fail type TemporaryMemoryBuffer dev 0 space Device stream 0000014F0A2B0240 size 1073741824 bytes (cudaMalloc error out of memory [2])
我是在我本地的笔记本上跑的,我想问,可不可以通过调节参数,把size设置小一点。

from knn-box.

ZhaoQianfeng avatar ZhaoQianfeng commented on June 11, 2024

可以试试把num_keys_to_add_at_a_time改小点,打开knnbox/datastore/datastore.py, 文件末尾的build_faiss_index函数调用时加行参数:

    def build_faiss_index(self, name, verbose=True, use_pca=False, pca_dim=256):
        r"""
        build faiss index for a data.
        the output file named name+.faiss_index

        Args:
            name: The data name which need to build faiss index
            verbose: display detailed message
            use_pca: wether do a PCA when building faiss index
            pca_dim: if use PCA, the PCA output dim
        """

        if not isinstance(self.datas[name], Memmap):
            print("ERROR: can only build faiss for Memmap object.")
            os.exit(1)
        # build faiss
        build_faiss_index(
                    self.datas[name].data, 
                    self.datas[name].shape,
                    os.path.join(self.path, name+".faiss_index"),
                    use_pca=use_pca,
                    pca_dim=pca_dim,
                    verbose=verbose,
                    num_keys_to_add_at_a_time=100000, # 加这行,这个值默认是50w,改小点试试
                    )

如果还是溢出就没办法了,一般10G显存的卡是够用的

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.