-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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: keras fit tests for segformer tf and minor refactors. #18412
Conversation
The documentation is not available anymore as the PR was closed or merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks okay to me but will defer to the TensorFlow experts :-)
Thanks for fixing!
Pinging @gante as this week's TF reviewer! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
(question: why is test_keras_fit
entirely overwritten?)
So, it made sense to test them in isolation. |
The line
Does the main issue come from the fact that |
I think so, yes. |
Looks like the new So, I incorporated the latest changes, bypassing the complete rewrite. @ydshieh @amyeroberts @gante up for another review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for double check, @sayakpaul . Happy to see we don't have to completely rewrite the test.
(I only look the latest change in test_keras_fit
)
@@ -331,64 +329,26 @@ def recursive_check(tuple_object, dict_object): | |||
|
|||
# todo: incorporate label support for semantic segmentation in `test_modeling_tf_common.py`. | |||
|
|||
@unittest.skipIf( | |||
not is_tf_available() or len(tf.config.list_physical_devices("GPU")) == 0, | |||
reason="TF (<=2.8) does not support backprop for grouped convolutions on CPU.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we haven't verified this with TF 2.9?
Once a new TF version supports this OP on CPU, it's good for us to add a version check inside skipIf
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for digging into this and fixing 🔧
Let gante push the final approval button 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fewer lines = <3
Thank you for having a look at the test @sayakpaul!
@sayakpaul our CI failed in the reworked test -- can you confirm that it runs correctly? :) https://github.com/huggingface/transformers/runs/7655675934?check_suite_focus=true |
…ce#18412) * fix: keras fit tests for segformer tf and minor refactors. * refactor: test_keras_fit to make it simpler using the existing one. * fix: styling issues.
Fixes the issues as noticed in: https://github.com/huggingface/transformers/runs/7485048615?check_suite_focus=true.
I don't have access to an instance having multiple GPUs at the moment, but I figured out the root cause of the issue.
transformers/tests/models/segformer/test_modeling_tf_segformer.py
Line 346 in df5e423
^ I wasn't calling the model on some sample inputs, which is why the weights retrieved from
get_weights()
were zero. That has been fixed in this PR.I tested it locally in isolation with the following snippet (I acknowledge that it's not super clean):
@amyeroberts @Rocketknight1 @sgugger