GithubHelp home page GithubHelp logo

Comments (7)

quanvuong avatar quanvuong commented on July 18, 2024 1

you can add it after loss.backward()

from fewshot_detection.

quanvuong avatar quanvuong commented on July 18, 2024

adding del loss and torch.cuda.empty_cache() solve this problem

from fewshot_detection.

quanvuong avatar quanvuong commented on July 18, 2024

Actually, using empty_cached() leads to really slow GPU operations (60 hours for the fine tuning step). Is there another work around?

If I simply do del loss without emptying the cache, the out of memory error still happens.

from fewshot_detection.

shenglih avatar shenglih commented on July 18, 2024

torch.cuda.empty_cache()

hi @quanvuong would you mind elaborating where to add these, much appreciated!

from fewshot_detection.

thsunkid avatar thsunkid commented on July 18, 2024

Hi @quanvuong,

Had you solved this problem ?
I got one similar when evaluating the baseline model, which caused CUDA error: out of memory due to accumulate the data from each iter.
I used torch 0.4.1 version. Already try to emty_cache() both del metax, mask but it doesn't help.

from fewshot_detection.

thsunkid avatar thsunkid commented on July 18, 2024

Hi @quanvuong,

Had you solved this problem ?
I got one similar when evaluating the baseline model, which caused CUDA error: out of memory due to accumulate the data from each iter.
I used torch 0.4.1 version. Already try to emty_cache() both del metax, mask but it doesn't help.

In my cases, I used torch v0.4.1 instead of v0.3.1 like the author used. I solved my problem by adding with torch.no_grad() during validation because volatile variable in Variable class no longer clear the gradient value, causing accumulated memory in GPU.

from fewshot_detection.

Fangyi-Chen avatar Fangyi-Chen commented on July 18, 2024

Based on my understanding, there are two reasons for the out-of-memory during tuning

  1. during the tuning phase, 20 class instead of 15 classes are fed into the re-weighting net. which causes more GPU memory usage.
  2. During the tuning phase, for multi-scale training, the input images can be as large as 600+. which leads to dynamic memory usage.

The solution could be 1. decrease the batch size a little bit
2. resize the input image size carefully

from fewshot_detection.

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.