Fix: Eagerly initialize ML Diagnostics to prevent Protobuf descriptor collision crash#4092
Open
bvandermoon wants to merge 1 commit into
Open
Fix: Eagerly initialize ML Diagnostics to prevent Protobuf descriptor collision crash#4092bvandermoon wants to merge 1 commit into
bvandermoon wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
317fbfb to
0731546
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Eagerly initializes
libtpu_metricat the beginning of MaxText's root initialization to prevent a fatal C++ Protobuf descriptor registration crash.Context & Problem
Customers experience a fatal C++ Protobuf descriptor registration crash (
File already exists in database: google/protobuf/timestamp.proto) when running MaxText training jobs with ML Diagnostics enabled (managed_mldiagnostics=True).Root Cause
Lazy loading of ML Diagnostics occurs midway through the training flow. By then, JAX and other extensions have already registered
timestamp.protoin the sharedDescriptorPool. Whenlibtpu_metric._initialize()is called later, it tries to register the same descriptor, causing an abort.Solution
Eagerly initialize
libtpu_metricat the beginning of MaxText's root initialization to ensure registration happens before JAX imports and callscloud_tpu_init(). We usemax_loggingfor cleaner logging integration and catch anyException(e.g. if the package isn't installed) to fail gracefully.Tests
Verified on dedicated TPU VM:
maxtextpackage completes successfully and printsINFO:absl:ML diagnostics initializationwithout any Protobuf descriptor registration crash:python3 -c "from absl import logging; logging.set_verbosity(logging.INFO); import maxtext"tests/unit/configs_test.pyand they all passed:Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.