Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixup DS issue with weakref #3143

Merged
merged 2 commits into from
Oct 8, 2024
Merged

Fixup DS issue with weakref #3143

merged 2 commits into from
Oct 8, 2024

Conversation

muellerzr
Copy link
Collaborator

What does this PR do?

@stas00 discovered that because we constantly create the transformers weakref (not just under zero3 now), we need to always set the "auto" values (such as batch size etc) if passed in by the user. Else we can hit an issue where it's still set as 'auto' and DS will yell at us:

stderr: [rank0]: Traceback (most recent call last):
stderr: [rank0]:   File "/root/dawn/dawn/train/causal/run.py", line 83, in <module>
stderr: [rank0]:     model = getattr(model_class, from_config)(
stderr: [rank0]:   File "/opt/conda/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 440, in from_config
stderr: [rank0]:     return model_class._from_config(config, **kwargs)
stderr: [rank0]:   File "/opt/conda/lib/python3.10/site-packages/transformers/modeling_utils.py", line 1515, in _from_config
stderr: [rank0]:     with deepspeed.zero.Init(config_dict_or_path=deepspeed_config()):
stderr: [rank0]:   File "/opt/conda/lib/python3.10/site-packages/deepspeed/runtime/zero/partition_parameters.py", line 941, in __init__
stderr: [rank0]:     _ds_config = deepspeed.runtime.config.DeepSpeedConfig(config_dict_or_path,
stderr: [rank0]:   File "/opt/conda/lib/python3.10/site-packages/deepspeed/runtime/config.py", line 798, in __init__
stderr: [rank0]:     self._configure_train_batch_size()
stderr: [rank0]:   File "/opt/conda/lib/python3.10/site-packages/deepspeed/runtime/config.py", line 981, in _configure_train_batch_size
stderr: [rank0]:     self._batch_assertion()
stderr: [rank0]:   File "/opt/conda/lib/python3.10/site-packages/deepspeed/runtime/config.py", line 923, in _batch_assertion
stderr: [rank0]:     assert (train_batch > 0), f"Train batch size: {train_batch} has to be greater than 0"
stderr: [rank0]: TypeError: '>' not supported between instances of 'str' and 'int'

Fixes # (issue)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@stas00 @SunMarc

@muellerzr muellerzr requested a review from SunMarc October 7, 2024 20:54
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@stas00
Copy link
Contributor

stas00 commented Oct 7, 2024

This fixes the problem, Zach - thank you!

Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !

@muellerzr muellerzr merged commit 506d732 into main Oct 8, 2024
27 of 28 checks passed
@muellerzr muellerzr deleted the fixup branch October 8, 2024 15:04
muellerzr added a commit that referenced this pull request Oct 12, 2024
* Fixup DS issue with weakref

* Clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants