Coder Social home page Coder Social logo

Comments (3)

lxuechen avatar lxuechen commented on August 17, 2024

Oh, thanks for pointing this out. You're absolutely correct. The AcceleratedOptimizer object has the right wraps that disable zero_grad on non-sync steps, and should be used for clearing gradients, as opposed to the wrapped model.

Looking at the history of our internal codebase, we were actually calling self.optimizer.zero_grad(set_to_none=True) until a commit on May 7 2023 changed this to the model. Note we have trained similarly performing PPO models both before and after that commit, so I think it's safe to say that this bug hasn't affected the results in noticeable ways.

Note the quark trainer doesn't have this problem, since I'm not using the accelerator ctx manager there.

from alpaca_farm.

lxuechen avatar lxuechen commented on August 17, 2024

Resolved in #58

from alpaca_farm.

shunzh avatar shunzh commented on August 17, 2024

Thanks for fixing this! However, I find that removing self.policy.zero_grad(set_to_none=True) immediately causes a cuda out-of-memory error. I'm running PPO training on 8 A100 GPUs. Have you encountered this issue?

from alpaca_farm.

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.