Git Product home page Git Product logo

Comments (2)

xiaoxiaojiea avatar xiaoxiaojiea commented on September 3, 2024

目前已解决,解决方法如下:

问题原因:fsmn.py 文件 class FSMN(nn.Module) 类的 forward 函数中的 torch.cat(in_cache, dim=-1) 会一直复制占用内存,导致内存不断升高。

更改方法:将这一行代码拆开这样写就可以了

# x7 = self.softmax(x6)
        x7, _ = x6
        # return x7, None

        # ===============================
        cat_size = sum(tensor.size(-1) for tensor in in_cache)
        ret_cache = torch.zeros([in_cache[0].shape[0], in_cache[0].shape[1], in_cache[0].shape[2], cat_size])

        for i in range(cat_size):
            ret_cache[:, :, :, i] = in_cache[i].detach().squeeze(-1)
        # ===============================


        return x7, ret_cache

from wekws.

mlxu995 avatar mlxu995 commented on September 3, 2024

我对 fsmn 不太熟,@duj12 靖哥你看这里的 detach() 会影响 fsmn 的训练吗

from wekws.

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.