Git Product home page Git Product logo

Comments (5)

tiandazhao avatar tiandazhao commented on July 19, 2024 1

@bkuster0 Thank you very much for your information. I have read it in detail. The fine-tuning of the CogVLM2 model does not support Zero3. But I still want to know what is the difference between the model supporting Zero3 and not supporting Zero3, or how should I modify the model to make it support Zero3. I hope someone can give me an answer to this question. I would be very grateful.

from deepspeed.

tjruwase avatar tjruwase commented on July 19, 2024

@tiandazhao, if using the HF+DeepSpeed integration properly then zero stage 3 would be detected at module initialization so that parameters are sharded across devices: https://huggingface.co/docs/transformers/main/en/deepspeed#non-trainer-deepspeed-integration

So, your observation is surprising. Are you able to share the log?

from deepspeed.

tiandazhao avatar tiandazhao commented on July 19, 2024

@tiandazhao, if using the HF+DeepSpeed integration properly then zero stage 3 would be detected at module initialization so that parameters are sharded across devices: https://huggingface.co/docs/transformers/main/en/deepspeed#non-trainer-deepspeed-integration
So, your observation is surprising. Are you able to share the log?
Since the logger generated in the process is quite messy, I will reorganize my questions.
Add Deepspeed's estimate of video memory usage: stage2
image

Add Deepspeed's estimate of video memory usage: stage3
image

When Transformers.trainer is initialized,Will enter the training loop and execute the self.accelerator.prepare method
image

Next, the deepspeed will initillize
image

Next, will create DeepSpeedEngine
image

then ,The _configure_distributed_model method in DeepSpeedEngine.init() will be run
image

In this method, it will check is_zero_init_model and dont_change_device
image

At this point the model has not been processed, there will be no ds_id in the parameters, and it is obvious that is_zero_init_model will definitely be False, so this is the problem. Next, self.module.to(self.device) will be executed, and then the entire model will be filled into the graphics card.

I am using three cards for training

image

Finally, when the training process starts, each graphics card has already stored the entire model, so it is not enough to support further training. So, the graphics memory overflows.
image

The above is my unprofessional and superficial understanding of the Deepspeed usage process. If there are any errors, please point them out. I also hope that you can answer my questions. Thank you very much.

from deepspeed.

CHNRyan avatar CHNRyan commented on July 19, 2024

Entirely same error when I fine tuning llama2. The is_zero_init_model is always False. And all params will load on each gpu without partition. @loadams @tjruwase @deepcharm

from deepspeed.

CHNRyan avatar CHNRyan commented on July 19, 2024

And I also confused why from_pretrained just load params to CPU memory and params load CPU to GPU memory in trainer.train.

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.