Skip to content

Conversation

@patil-suraj
Copy link
Contributor

@patil-suraj patil-suraj commented Apr 5, 2022

What does this PR do?

In from_pretrained the state_dict is loaded twice when low_cpu_mem_usage is True, which is not required since the state_dict is already loaded before as we can here.

if not is_sharded:
# Time to load the checkpoint
state_dict = load_state_dict(resolved_archive_file)

So, it's fine to remove it there because when is_sharded=False, the state_dict is loaded at line 1797

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Apr 5, 2022

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

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.

To complete the description, it's fine to remove it there because when is_sharded=False, the state_dict is loaded at line 1797.

@patil-suraj patil-suraj merged commit 47c5c05 into huggingface:main Apr 6, 2022
@patil-suraj patil-suraj deleted the load-sd-once branch April 6, 2022 09:43
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