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

Large model loading: add link to existing documentation #17931

Merged
merged 1 commit into from
Jul 4, 2022

Conversation

LysandreJik
Copy link
Member

The documentation for large model loading is in two different places. This adds a link from one to the other, showing the auto device map.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 29, 2022

The documentation is not available anymore as the PR was closed or merged.

@LysandreJik LysandreJik requested a review from sgugger June 29, 2022 08:44
@LysandreJik LysandreJik marked this pull request as ready for review June 29, 2022 08:44
Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Those are actually two different things: the from_pretrained method performs a lot of logic specific to Transformers models that Accelerate (which is model agnostic) does not, so it's unlikely to be useful to the user to go browse that doc. For instance, you can't load an opt model directly in OPTForCausalLM using Accelerate.

So I'd still keep the paragraph about low memory loading.

@LysandreJik
Copy link
Member Author

Hmmm yes, I agree, but this is still linking to from_pretrained, just a part of the documentation that contains more information about the low_cpu_mem_usage. The part I have removed glosses over it quickly, whereas the part I link to has extensive documentation covering both low_cpu_mem_usage and the device_map argument to pass to from_pretrained.

Reading the documentation right now, if we're interested in big models and we open the "Instantiating a big model" page in the toctree, there are no mention of the device_map. This is what this PR aims to fix.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Ah my mistake, I thought the link was going to the doc of Accelerate 🤦‍♂️

@LysandreJik LysandreJik merged commit 7b18702 into main Jul 4, 2022
@LysandreJik LysandreJik deleted the link-large-model-doc branch July 4, 2022 08:13
viclzhu pushed a commit to viclzhu/transformers that referenced this pull request Jul 18, 2022
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.

3 participants