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

Fix FlaxPretTrainedModel pt weights check #19133

Merged
merged 3 commits into from
Sep 21, 2022

Conversation

mishig25
Copy link
Contributor

@mishig25 mishig25 commented Sep 21, 2022

What does this PR do?

files tab should make it clear on what's being changed.

if os.path.join(pretrained_model_name_or_path, WEIGHTS_NAME)
# will evaluate always to True as long as `pretrained_model_name_or_path` is a non-empty str

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Sep 21, 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.

Thanks for the fix!

@@ -664,13 +664,14 @@ def from_pretrained(
# Load from a sharded Flax checkpoint
archive_file = os.path.join(pretrained_model_name_or_path, FLAX_WEIGHTS_INDEX_NAME)
is_sharded = True
# At this stage we don't have a weight file so we will raise an error.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure why this comment is deleted as an error is raised after this stage (just different ones depending on the if). It should be left here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh indded

src/transformers/modeling_flax_utils.py Outdated Show resolved Hide resolved
Mishig Davaadorj and others added 2 commits September 21, 2022 13:58
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
@mishig25 mishig25 merged commit 486134e into huggingface:main Sep 21, 2022
oneraghavan pushed a commit to oneraghavan/transformers that referenced this pull request Sep 26, 2022
* Fix FlaxPretTrainedModel pt weights check

* Update src/transformers/modeling_flax_utils.py

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>

* fix raise comment

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
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