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

Add TPU testing #591

Merged
merged 8 commits into from
Jan 5, 2023
Merged

Conversation

chenmoneygithub
Copy link
Contributor

No description provided.

@chenmoneygithub chenmoneygithub marked this pull request as draft December 20, 2022 23:21
@chenmoneygithub chenmoneygithub marked this pull request as ready for review December 27, 2022 21:59
This will allow us to share a single tpu strategy (which it sounds like
it is expensive to set up), without needing to consolidate all our TPU
testing code to a single file, which could get unwieldy.
@mattdangerw
Copy link
Member

Thanks for this!

I think my main piece of feedback is that we should avoid consolidating all the TPU test out of tree with the models themselves. We should keep this testing right with the rest of the model testing, so we can keep it from getting stale (and make sure people adding new models add TPU tests).

From talking with you it sound like the main difficulty is that connecting to a TPU is slow and expensive, but I think we can work around this with pytest fixtures, which will allow you to do session level setup in a modular way. This is slightly awkward given that our actual tests unittest not pytest (see this doc).

But think I was able to get it working. I pushed a commit to this branch switching to tests directly in the model code using a session level tpu strategy. Take a look, modify as needed!

@jbischof jbischof self-requested a review January 3, 2023 19:48
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.

lgtm. should we add tpu testing for other models, or leave that as a follow up?

Copy link
Contributor

@jbischof jbischof left a comment

Choose a reason for hiding this comment

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

I like how the tests are now integrated with pytest flags! Would it add anything to do a couple of batches of model.fit for TPU compat?

@chenmoneygithub
Copy link
Contributor Author

@jbischof Yes! I will make a followup PR to enrich our TPU testing's coverage.

@chenmoneygithub chenmoneygithub merged commit 1dfed90 into keras-team:master Jan 5, 2023
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