Skip to content

Fix bug where the linen Module state is reused. #2025

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

Merged
merged 1 commit into from
Apr 5, 2022

Conversation

jheek
Copy link
Member

@jheek jheek commented Apr 4, 2022

For example in scan the transform_fn is called twice.
This led to mis counting compact call default names (see test case)

For example in scan the tranfsorm_fn is called twice.
This led to mis counting compact call default names (see test case)
@jheek jheek requested a review from levskaya April 4, 2022 13:02
@codecov-commenter
Copy link

Codecov Report

Merging #2025 (8c6a16b) into main (f7947da) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #2025   +/-   ##
=======================================
  Coverage   74.85%   74.86%           
=======================================
  Files          59       59           
  Lines        5035     5037    +2     
=======================================
+ Hits         3769     3771    +2     
  Misses       1266     1266           
Impacted Files Coverage Δ
flax/linen/transforms.py 96.62% <100.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f7947da...8c6a16b. Read the comment docs.

Copy link
Collaborator

@levskaya levskaya left a comment

Choose a reason for hiding this comment

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

Ha - thanks so much for catching that. Hopefully no one depends on wonky default names in checkpoints - I don't think too many people use scanned layers yet... (I wonder if it's worth doing a global test internally to be safe?)

@jheek
Copy link
Member Author

jheek commented Apr 5, 2022

Hopefully no one depends on wonky default names in checkpoints

You can't depend on it because the behavior changes between init and apply (only init was wrong and apply would fail with param not found)

@copybara-service copybara-service bot merged commit 0c647cb into google:main Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants