GithubHelp home page GithubHelp logo

Comments (7)

jomayeri avatar jomayeri commented on July 3, 2024

You can try to use zero_init, but I believe for HF the correct method is to place HfDeepSpeedConfig before the from_pretrained method. See this comment and issue thread #3168 (comment)

from deepspeed.

CHNRyan avatar CHNRyan commented on July 3, 2024

You can try to use zero_init, but I believe for HF the correct method is to place HfDeepSpeedConfig before the from_pretrained method. See this comment and issue thread #3168 (comment)

@jomayeri Thanks for your reply! I use DS and Accelerate and "zero_init" setted in my Accelerate config "zero3_init_flag: true". And I put the TrainingArguments before from_pretrained to asure I'm using zero_init. But I didn't use HfDeepSpeedConfig, should I use it with HFTrainer?

from deepspeed.

CHNRyan avatar CHNRyan commented on July 3, 2024

And I also find that in deepspeed/runtime/engine.py, when run the _configure_distributed_model the is_zero_init_model is judged to False though I use "zero3_init_flag: true". And then all parameters load to GPUs.
(Q5D%SD~9W 7O)4}@PY9PIK

from deepspeed.

jomayeri avatar jomayeri commented on July 3, 2024

Hmm, the config might not be passed properly from the Trainer. I'll investigate that. Can you check if adding HfDeepSpeedConfig before from_pretrained works for you?

from deepspeed.

CHNRyan avatar CHNRyan commented on July 3, 2024

@jomayeri According to "However, if you want to use DeepSpeed without the [Trainer](https://huggingface.co/docs/transformers/v4.41.3/en/main_classes/trainer#transformers.Trainer), Transformers provides a HfDeepSpeedConfig class." in https://huggingface.co/docs/transformers/main_classes/deepspeed, I think it don't need to add HfDeepSpeedConfig because once I set zero3 before from_pretrained(), trainer or trl will do correct things automatically. And I find that maybe is bnb prevent zero_init because it runs successfully after I remove bnb_config.

from deepspeed.

CHNRyan avatar CHNRyan commented on July 3, 2024

@jomayeri Maybe you can see #5660 for more details. Thanks!

from deepspeed.

jomayeri avatar jomayeri commented on July 3, 2024

Closing in favor of #5660

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.