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

Update layout_map to use re.search instead of re.match. #18555

Merged
merged 4 commits into from
Oct 6, 2023

Conversation

qlzh727
Copy link
Member

@qlzh727 qlzh727 commented Oct 5, 2023

This allow user to skip the leading ".*' and make the rule more readable.

This allow user to skip the leading ".*' and make the rule more readable.
layout_map['.*dense.*bias'] = ('model',)
layout_map['.*conv2d.*kernel'] = (None, None, None, 'model')
layout_map['.*conv2d.*bias'] = ('model',)
layout_map['dense.*kernel'] = (None, 'model')
Copy link
Member

Choose a reason for hiding this comment

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

what's the reason for .* in the middle instead of / again? the optimizer layout paths?

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, that's for dense_1/dense_2.

Copy link
Member

Choose a reason for hiding this comment

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

ah right thanks! so i guess that will be up to the user's practice. if they are setting the name themselves on all layers, that won't be necessary (I think?), if they are not, they should leave that in

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct.

@codecov-commenter
Copy link

codecov-commenter commented Oct 5, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (25e4fa6) 78.00% compared to head (6e370fb) 74.25%.
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #18555      +/-   ##
==========================================
- Coverage   78.00%   74.25%   -3.76%     
==========================================
  Files         334      334              
  Lines       32351    32384      +33     
  Branches     6313     6319       +6     
==========================================
- Hits        25237    24046    -1191     
- Misses       5546     6815    +1269     
+ Partials     1568     1523      -45     
Flag Coverage Δ
keras 74.18% <100.00%> (-3.74%) ⬇️
keras-jax 63.39% <100.00%> (-0.03%) ⬇️
keras-numpy ?
keras-tensorflow 63.41% <100.00%> (-0.03%) ⬇️
keras-torch 64.29% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
keras/distribution/distribution_lib.py 95.20% <100.00%> (+0.14%) ⬆️

... and 19 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@mattdangerw mattdangerw left a comment

Choose a reason for hiding this comment

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

This looks good to me! I am trying to follow suit for the LoRA api (similar weight matching based on path required), so I can make the same change over there.

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels Oct 5, 2023
keras/distribution/distribution_lib.py Outdated Show resolved Hide resolved
keras/distribution/distribution_lib.py Outdated Show resolved Hide resolved
keras/distribution/distribution_lib.py Outdated Show resolved Hide resolved
keras/distribution/distribution_lib.py Outdated Show resolved Hide resolved
@google-ml-butler google-ml-butler bot removed the ready to pull Ready to be merged into the codebase label Oct 6, 2023
@qlzh727 qlzh727 requested a review from fchollet October 6, 2023 17:12
Copy link
Member

@fchollet fchollet left a comment

Choose a reason for hiding this comment

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

LGTM

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels Oct 6, 2023
@fchollet fchollet merged commit f1ed36d into keras-team:master Oct 6, 2023
7 checks passed
@google-ml-butler google-ml-butler bot removed awaiting review ready to pull Ready to be merged into the codebase kokoro:force-run labels Oct 6, 2023
@qlzh727 qlzh727 deleted the layout_map branch October 10, 2023 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants