Coder Social home page Coder Social logo

Comments (2)

windj007 avatar windj007 commented on July 20, 2024

Hi!

Our pipeline supports mixed precision training - just by adding trainer.kwargs.precision=16 +trainer.kwargs.amp_backend=native +trainer.kwargs.amp_level=O1. All arguments in the trainer.kwargs namespace go to pytorch_lightning Trainer - so please refer to their docs for more info.

However, as fft is executed via a function (not a module) pytorch cannot add hooks for type conversion. Thus, it seems that there is no built-in way to enable mixed-precision training with FFT - you have to manually wrap these parts with x.float() and ffted.half().

By the way, we tried to train a Lama-Regular (fully-conv resnet, no FFC) in FP16 and it consistently diverged. However, we did that in the beginning of the project and did not re-check it with final models and a newer Pytorch.

Personally, I often face lack of stability with FP16 in multi-objective training - not only in inpainting. It usually works well with a single loss, but when I try to mix e.g. segmentation + localization or reconstruction + discriminator - loss explodes to nan after a few hundred iterations.

I'd be happy to hear from you if FP16 works finally :)

from lama.

ternaus avatar ternaus commented on July 20, 2024

I was not able to make it work in FP16 successfully.

But disabling validation and saved a lot of memory on GPU 0 and it is good enough for now :)

from lama.

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.