examples: wire TensorBoardWriter into trainer entry points#623
Draft
kmontemayor2-sc wants to merge 4 commits intomainfrom
Draft
examples: wire TensorBoardWriter into trainer entry points#623kmontemayor2-sc wants to merge 4 commits intomainfrom
kmontemayor2-sc wants to merge 4 commits intomainfrom
Conversation
Adds two optional fields on ``VertexAiResourceConfig`` for opting into Vertex AI TensorBoard. ``tensorboard_resource_name`` points at an existing ``Tensorboard`` resource; ``tensorboard_experiment_name`` is the user-chosen ``TensorboardExperiment`` ID under that resource — multiple jobs sharing this name surface as comparable runs on the same TB page. The fields must be set together (or both unset). The validation rule is not enforced yet (lands in a follow-up PR); this commit only adds the proto fields and regenerates Python + Scala stubs. Also expands the docstring on ``TrainedModelMetadata.tensorboard_logs_uri`` to document its mapping to ``AIP_TENSORBOARD_LOG_DIR`` via ``CustomJobSpec.baseOutputDirectory``. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds the launcher-side TensorBoard plumbing. After this PR, callers that pass ``tensorboard_logs_uri`` get ``baseOutputDirectory`` set on the CustomJob, and resource configs that set ``tensorboard_experiment_name`` get three env vars injected into the worker container so the trainer's chief-rank uploader can find the named experiment. - ``_build_job_config`` accepts ``tensorboard_logs_uri: Optional[Uri]`` and derives ``base_output_dir`` from it. - When the resource config sets ``tensorboard_experiment_name``, inject ``GIGL_TENSORBOARD_RESOURCE_NAME``, ``GIGL_TENSORBOARD_EXPERIMENT_NAME``, and ``GIGL_TENSORBOARD_RUN_NAME`` (sanitized + UTC-suffixed for per-launch uniqueness). - ``_maybe_log_tensorboard_url`` prints the cross-job TB experiment URL at submit time so the link is visible in the launcher's local stdout. - ``VertexAiJobConfig`` gains a ``base_output_dir`` field, threaded through to ``aiplatform.CustomJob``. - ``get_tensorboard_logs_gcs_path`` now returns ``<asset_dir>/logs/`` (was ``<asset_dir>/tensorboard_logs/``), aligning with Vertex AI's ``<base_output_dir>/logs/`` convention so writer events land where ``AIP_TENSORBOARD_LOG_DIR`` points. Updates the ConfigPopulator unit test that asserts on the path suffix. Reading the new fields off the resource config and the ``tensorboard_logs_uri`` off the GbmlConfig is deferred to the next PR (trainer/inferencer dispatch) — production trainers don't pass ``tensorboard_logs_uri`` yet, so this change is invisible to existing production runs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reads ``TrainedModelMetadata.tensorboard_logs_uri`` from the GbmlConfig and threads it into ``launch_single_pool_job`` / ``launch_graph_store_enabled_job`` from both ``GLTTrainer`` and ``GLTInferencer``. After this PR, the launcher (PR 3) actually receives the GCS path on real training and inference jobs, which means ``baseOutputDirectory`` gets set on the CustomJob and ``AIP_TENSORBOARD_LOG_DIR`` is populated inside the worker container. The chief-rank uploader / writer (next PR) is what reads those env vars and starts streaming events. Sharing ``tensorboard_logs_uri`` across trainer and inferencer is deliberate: Vertex's ``baseOutputDirectory`` is component-agnostic, and the launcher injects a different ``GIGL_TENSORBOARD_RUN_NAME`` per job (``gigl_train_<task>`` vs ``gigl_infer_<task>``), so the two surface as separate runs in the same ``TensorboardExperiment``. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds chief-rank TensorBoard event emission to the four example trainer
entry points (homogeneous + heterogeneous, single-pool + graph-store).
Each trainer now:
- constructs ``tensorboard_writer = TensorBoardWriter.from_env(enabled=is_chief_process)``
- calls ``tensorboard_writer.log({...}, step=batch_idx)`` for train,
val, and test loss curves
- closes the writer at the end (paired uploader shutdown)
Updates the example resource configs with both
``tensorboard_resource_name`` and ``tensorboard_experiment_name``
(populated with the placeholder ``user-provided-experiment-name`` —
valid under the Vertex AI Experiment ID regex enforced by validation).
The CORA task config gains a comment pointing at the new proto field.
The README adds a TensorBoard section documenting the two fields and
the URL-in-stdout flow.
The writer files (``gigl/utils/tensorboard_writer.py`` +
``tests/unit/utils/tensorboard_writer_test.py``) ride along since this
PR depends on them; they're owned by the writer PR and will collapse
out of this diff once that PR merges.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
/all_test |
Contributor
GiGL Automation@ 20:32:38UTC : 🔄 @ 20:41:39UTC : ✅ Workflow completed successfully. |
Contributor
GiGL Automation@ 20:32:39UTC : 🔄 @ 20:42:54UTC : ✅ Workflow completed successfully. |
Contributor
GiGL Automation@ 20:32:43UTC : 🔄 @ 20:34:42UTC : ✅ Workflow completed successfully. |
Contributor
GiGL Automation@ 20:32:44UTC : 🔄 @ 21:57:00UTC : ❌ Workflow failed. |
Contributor
GiGL Automation@ 20:32:46UTC : 🔄 @ 21:27:11UTC : ✅ Workflow completed successfully. |
Contributor
GiGL Automation@ 20:32:47UTC : 🔄 @ 21:50:25UTC : ✅ Workflow completed successfully. |
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.
Adds chief-rank TensorBoard event emission to the four example trainer
entry points (homogeneous + heterogeneous, single-pool + graph-store).
Each trainer now:
tensorboard_writer = TensorBoardWriter.from_env(enabled=is_chief_process)tensorboard_writer.log({...}, step=batch_idx)for train,val, and test loss curves
Updates the example resource configs with both
tensorboard_resource_nameandtensorboard_experiment_name(populated with the placeholder
user-provided-experiment-name—valid under the Vertex AI Experiment ID regex enforced by validation).
The CORA task config gains a comment pointing at the new proto field.
The README adds a TensorBoard section documenting the two fields and
the URL-in-stdout flow.
The writer files (
gigl/utils/tensorboard_writer.py+tests/unit/utils/tensorboard_writer_test.py) ride along since thisPR depends on them; they're owned by the writer PR and will collapse
out of this diff once that PR merges.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com