Skip to content

preserve parameter keys when removing prefix#3564

Merged
SunMarc merged 2 commits into
huggingface:mainfrom
mjkvaak-amd:fix/fsdp2_canonicalize_names
May 13, 2025
Merged

preserve parameter keys when removing prefix#3564
SunMarc merged 2 commits into
huggingface:mainfrom
mjkvaak-amd:fix/fsdp2_canonicalize_names

Conversation

@mjkvaak-amd
Copy link
Copy Markdown
Contributor

@mjkvaak-amd mjkvaak-amd commented May 13, 2025

What does this PR do?

Earlier PR #3560 broke FSDP2 for non-compiled models due to omitted keys from the named_params dict. This change fixes the mistake in the if-replace logic, by conditionally stripping the "_orig_mod." prefix only when it's present as intended.

Fixes #3554

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?

@S1ro1, @SunMarc

Copy link
Copy Markdown
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 noticing this !

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

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.

@SunMarc
Copy link
Copy Markdown
Member

SunMarc commented May 13, 2025

@bot /style

@github-actions
Copy link
Copy Markdown
Contributor

Style fixes have been applied. View the workflow run here.

Copy link
Copy Markdown
Contributor

@S1ro1 S1ro1 left a comment

Choose a reason for hiding this comment

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

Thank you for the catch! LGTM.

@SunMarc SunMarc merged commit 281314b into huggingface:main May 13, 2025
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.

Parameter name conflict with FSDP2 and torch.compile

4 participants