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

[docs] Doc sprint #3099

Merged
merged 3 commits into from
Sep 11, 2024
Merged

[docs] Doc sprint #3099

merged 3 commits into from
Sep 11, 2024

Conversation

stevhliu
Copy link
Member

Addresses the docs improvements internally discussed:

  • add headers for more classes/functions in the API docs so they're easier and faster to find
  • fix unsupported <Note> tags
  • align title in the toctree with the header referenced in the doc
  • remove 🤗 emoji to avoid cluttering

@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.

Copy link
Collaborator

@muellerzr muellerzr left a comment

Choose a reason for hiding this comment

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

Nice! 🤩

cc @SunMarc for the inference related docs

# Utilities for Fully Sharded Data Parallelism
# Fully Sharded Data Parallel utilities

## enable_fsdp_ram_efficient_loading
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wish we didn't have to do this everywhere but I suppose can't be helped :/

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.

Thanks for this sprint @stevhliu ! The big model inference part is a lot nicer now ! I left a few suggestions

docs/source/_toctree.yml Outdated Show resolved Hide resolved
docs/source/package_reference/inference.md Outdated Show resolved Hide resolved
docs/source/package_reference/inference.md Outdated Show resolved Hide resolved
docs/source/usage_guides/big_modeling.md Outdated Show resolved Hide resolved
docs/source/usage_guides/big_modeling.md Outdated Show resolved Hide resolved

The general idea with pipeline parallelism is: say you have 4 GPUs and a model big enough it can be *split* on four GPUs using `device_map="auto"`. With this method you can send in 4 inputs at a time (for example here, any amount works) and each model chunk will work on an input, then receive the next input once the prior chunk finished, making it *much* more efficient **and faster** than the method described earlier. Here's a visual taken from the PyTorch repository:

![PiPPy example](https://camo.githubusercontent.com/681d7f415d6142face9dd1b837bdb2e340e5e01a58c3a4b119dea6c0d99e2ce0/68747470733a2f2f692e696d6775722e636f6d2f657955633934372e706e67)

To illustrate how you can use this with Accelerate, we have created an [example zoo](https://github.com/huggingface/accelerate/tree/main/examples/inference) showcasing a number of different models and situations. In this tutorial, we'll show this method for GPT2 across two GPUs.

Before you proceed, please make sure you have the latest pippy installed by running the following:
Before you proceed, please make sure you have the latest PyTorch version installed by running the following:
Copy link
Member Author

Choose a reason for hiding this comment

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

I also updated the installation instructions here, let me know if its incorrect!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nope it's correct :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

in a follow-up after this I'll fix the PiPPy example chunk so we don't have a merge conflict :)

@muellerzr muellerzr merged commit fc52fa9 into huggingface:main Sep 11, 2024
2 checks passed
@stevhliu stevhliu deleted the doc-improvements branch September 11, 2024 20:24
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