GithubHelp home page GithubHelp logo

Comments (6)

mrwyattii avatar mrwyattii commented on July 2, 2024

Hi @Tianwei-She thanks for using MII. It looks like you're seeing this problem because we try to load the model in fp32 onto each GPU before converting it to fp16 here.

In general, MII is not the most efficient with GPU memory when running multi-GPU, because:

  • we load the model onto each GPU before distributing it with DeepSpeed-Inference
  • we always load the model with the default dtype (which is typically fp32)

Here's a PR to address some of these inefficiencies by loading with the user-specified dtype and allowing the user to use system memory to load the model before distributing the model across GPUs. Please give #105 a try and let me know if that fixes your problem:
pip install git+https://github.com/microsoft/deepspeed-mii@mrwyattii/address-poor-vram-usage

The script you shared should work with these changes, but if it doesn't try adding "load_with_sys_mem": True to your mii_configs.

Note: Unfortunately, we will still need to load the entire model tensor_parallel times (either one copy on each GPU, or all on system memory). We are working on addressing this issue, but I don't have a fix right now.

from deepspeed-mii.

mrwyattii avatar mrwyattii commented on July 2, 2024

Closing due to inactivity and #105 has been merged, please reopen if you are seeing the same error with the latest DeepSpeed-MII.

from deepspeed-mii.

wangshankun avatar wangshankun commented on July 2, 2024

@mrwyattii Same error in V0.0.4
Config:
mii_config = {"tensor_parallel": 1, 'dtype': 'fp16', "load_with_sys_mem": True} name = "facebook/opt-30b" ds_config = { "fp16": { "enabled": True }, "bf16": { "enabled": False }, "zero_optimization": { "stage": 3, "offload_param": { "device": "cpu", "pin_memory": False, }, }, "train_micro_batch_size_per_gpu": 1, }
image

from deepspeed-mii.

mrwyattii avatar mrwyattii commented on July 2, 2024

@wangshankun what kind of GPU are you trying to run on? The OPT-30b model is ~60GB in size. From the screenshot you shared, it looks like you only have 22GB of GPU memory available and will not be able to run a model this large:
image

from deepspeed-mii.

wangshankun avatar wangshankun commented on July 2, 2024

@mrwyattii
Did I misunderstand the meaning of CPU offload in Zero3?

It is precisely because the GPU memory is insufficient that I want to place the model in the host, which is why I configured CPU offload and load_with_sys_mem.

from deepspeed-mii.

moussaba avatar moussaba commented on July 2, 2024

Same question...Does Zero offload actually work in mii, I have been having a lot of difficulties trying to get DeepSpeed-MII to do any soft of cpu or nvme offload.

from deepspeed-mii.

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.