Coder Social home page Coder Social logo

Comments (4)

shh2000 avatar shh2000 commented on May 18, 2024 1

similar question. here's some findings:

  1. deepspeed's doc claimed in ZeRO-O3 with ZeRO.init context, params is copied(for DP) and transfered to GPU layer by layer, while O2 is not.
  2. i use 13B, A100 80G*8, 1TB CPU memory to test. when O2, it use about 500 GB memory. 13B*4Byte/param*DP8=416GB, reasonable.
  3. when using 500GB CPU memory(reduce 50% memory), CPU OOM
  4. changing to O3, still CPU OOM.

so maybe we use O3 zero.init incorrectly, or deepspeed has a bug around here.

to your scenario, 70*4*4=1120GB>1TB, CPU OOM. maybe you can try load half layer(40 layer instead of 80 layer)? it likely to use 560+ GB memory, which does not cause CPU OOM

however, even half layers does not OOM, there's still the bug: when loading and copying weights layer by layer, does deepspeed release the memory of former layers in O3?

from deepspeed.

shh2000 avatar shh2000 commented on May 18, 2024 1

similar question. here's some findings:

  1. deepspeed's doc claimed in ZeRO-O3 with ZeRO.init context, params is copied(for DP) and transfered to GPU layer by layer, while O2 is not.
  2. i use 13B, A100 80G8, 1TB CPU memory to test. when O2, it use about 500 GB memory. 13B4Byte/param*DP8=416GB, reasonable.
  3. when using 500GB CPU memory(reduce 50% memory), CPU OOM
  4. changing to O3, still CPU OOM.

so maybe we use O3 zero.init incorrectly, or deepspeed has a bug around here.

to your scenario, 7044=1120GB>1TB, CPU OOM. maybe you can try load half layer(40 layer instead of 80 layer)? it likely to use 560+ GB memory, which does not cause CPU OOM

however, even half layers does not OOM, there's still the bug: when loading and copying weights layer by layer, does deepspeed release the memory of former layers in O3?

ref: https://deepspeed.readthedocs.io/en/latest/memory.html , grep "And often, itโ€™s not even possible to buy GPUs with a lot of RAM (112GB GPU anybody?) since they simply donโ€™t yet exist."

from deepspeed.

66RING avatar 66RING commented on May 18, 2024 1

similar question. here's some findings:

  1. deepspeed's doc claimed in ZeRO-O3 with ZeRO.init context, params is copied(for DP) and transfered to GPU layer by layer, while O2 is not.
  2. i use 13B, A100 80G8, 1TB CPU memory to test. when O2, it use about 500 GB memory. 13B4Byte/param*DP8=416GB, reasonable.
  3. when using 500GB CPU memory(reduce 50% memory), CPU OOM
  4. changing to O3, still CPU OOM.

so maybe we use O3 zero.init incorrectly, or deepspeed has a bug around here.

to your scenario, 7044=1120GB>1TB, CPU OOM. maybe you can try load half layer(40 layer instead of 80 layer)? it likely to use 560+ GB memory, which does not cause CPU OOM

however, even half layers does not OOM, there's still the bug: when loading and copying weights layer by layer, does deepspeed release the memory of former layers in O3?

@shh2000 hi I have some new findings. and it works. You need to use deepspeed.zero.init to handle lager model. like

        config = LlamaConfig.from_pretrained(model_name_or_path)
        with deepspeed.zero.Init():
            model = AutoModelForCausalLM.from_config(config, trust_remote_code=True)

from deepspeed.

66RING avatar 66RING commented on May 18, 2024

And directly load model to GPU works fine. Use the device_map parameter like

AutoModelForCausalLM.from_config(config, device_map="auto", trust_remote_code=True)

from deepspeed.

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.