Stay organized with collections
Save and categorize content based on your preferences.
You can upload existing logs to your Vertex AI TensorBoard instance
that were created by training locally, training outside of Vertex AI,
created by a colleague, are example logs, or were created using a different
Vertex AI TensorBoard instance. Logs can be shared among
multiple Vertex AI TensorBoard instances.
Vertex AI TensorBoard offers Google Cloud CLI and Vertex AI SDK for Python
for uploading TensorBoard logs. You can upload logs from any environment
that can connect to Google Cloud.
The uploader CLI by default runs indefinitely, monitoring changes in the LOG_DIR,
and uploads newly added logs. --one_shot=True disables the
behavior. Run tb-gcp-uploader --help for more information.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-26 UTC."],[],[],null,["# Upload logs to Vertex AI TensorBoard\n\n\u003cbr /\u003e\n\nYou can upload existing logs to your Vertex AI TensorBoard instance\nthat were created by training locally, training outside of Vertex AI,\ncreated by a colleague, are example logs, or were created using a different\nVertex AI TensorBoard instance. Logs can be shared among\nmultiple Vertex AI TensorBoard instances.\n\nVertex AI TensorBoard offers Google Cloud CLI and Vertex AI SDK for Python\nfor uploading TensorBoard logs. You can upload logs from any environment\nthat can connect to Google Cloud. \n\n### Vertex AI SDK for Python\n\n### Continuous monitoring\n\n\nFor continuous monitoring call `aiplatform.start_upload_tb_log` at the beginning\nof the training.\nThe SDK opens a new thread for uploading. This thread monitors for new data in the\ndirectory, and uploads it to your Vertex AI TensorBoard experiment.\nWhen training completes, call `end_upload_tb_log` to end the uploader thread.\n\n\nNote that after calling `start_upload_tb_log()` your thread will kept alive even if\nan exception is thrown. To ensure the thread gets shut down, put any code after\n`start_upload_tb_log()` and before `end_upload_tb_log()` in a\n`try` statement, and call `end_upload_tb_log()` in `finally`.\n\n### Python\n\n from typing import Optional\n\n from google.cloud import aiplatform\n\n\n def upload_tensorboard_log_continuously_sample(\n tensorboard_experiment_name: str,\n logdir: str,\n tensorboard_id: str,\n project: str,\n location: str,\n experiment_display_name: Optional[str] = None,\n run_name_prefix: Optional[str] = None,\n description: Optional[str] = None,\n ) -\u003e None:\n\n aiplatform.init(project=project, location=location)\n\n # Continuous monitoring\n aiplatform.start_upload_tb_log(\n tensorboard_id=tensorboard_id,\n tensorboard_experiment_name=tensorboard_experiment_name,\n logdir=logdir,\n experiment_display_name=experiment_display_name,\n run_name_prefix=run_name_prefix,\n description=description,\n )\n\n try:\n print(\"Insert your code here\")\n finally:\n aiplatform.end_upload_tb_log()\n\n- `tensorboard_experiment_name`: The name of the TensorBoard experiment to upload to.\n- `logdir`: The directory location to check for TensorBoard logs.\n- `tensorboard_id`: The [TensorBoard instance ID](/vertex-ai/docs/experiments/tensorboard-setup#tensorboard_id). If not set, the `tensorboard_id` in `aiplatform.init` is used.\n- `project`: . You can find you Project ID in the Google Cloud console [welcome](https://console.cloud.google.com/welcome) page.\n- `location`: The location where your TensorBoard instance is located.\n- `experiment_display_name`: The display name of the experiment.\n- `run_name_prefix`: If present, all runs created by this invocation will have their name prefixed by this value.\n- `description`: A string description to assign to the experiment.\n\n### One time logging\n\n### Upload TensorBoard logs\n\n\nCall `aiplatform.upload_tb_log` to perform a one-time upload of TensorBoard logs.\nThis uploads existing data in the logdir and then returns immediately.\n\n### Python\n\n from typing import Optional\n\n from google.cloud import aiplatform\n\n\n def upload_tensorboard_log_one_time_sample(\n tensorboard_experiment_name: str,\n logdir: str,\n tensorboard_id: str,\n project: str,\n location: str,\n experiment_display_name: Optional[str] = None,\n run_name_prefix: Optional[str] = None,\n description: Optional[str] = None,\n verbosity: Optional[int] = 1,\n ) -\u003e None:\n\n aiplatform.init(project=project, location=location)\n\n # one time upload\n aiplatform.upload_tb_log(\n tensorboard_id=tensorboard_id,\n tensorboard_experiment_name=tensorboard_experiment_name,\n logdir=logdir,\n experiment_display_name=experiment_display_name,\n run_name_prefix=run_name_prefix,\n description=description,\n )\n\n- `tensorboard_experiment_name`: The name of the TensorBoard experiment.\n- `logdir`: The directory location to check for TensorBoard logs.\n- `tensorboard_id`: The [TensorBoard instance ID](/vertex-ai/docs/experiments/tensorboard-setup#tensorboard_id). If not set, the `tensorboard_id` in `aiplatform.init` is used.\n- `project`: . You can find these Project IDs in the Google Cloud console [welcome](https://console.cloud.google.com/welcome) page.\n- `location`: The location where your TensorBoard instance is located.\n- `experiment_display_name`: The display name of the experiment.\n- `run_name_prefix`: If present, all runs created by this invocation will have their name prefixed by this value.\n- `description`: A string description to assign to the experiment.\n- `verbosity`: Level of statistics verbosity, an integer. Supported values: 0 - No upload statistics are printed. 1 - Print upload statistics while uploading data (default).\n\n### Upload profile logs\n\n\nCall `aiplatform.upload_tb_log` to upload TensorBoard profile logs to an experiment.\n\n### Python\n\n from typing import FrozenSet\n\n from google.cloud import aiplatform\n\n\n def upload_tensorboard_profile_logs_to_experiment_sample(\n experiment_name: str,\n logdir: str,\n project: str,\n location: str,\n run_name_prefix: str,\n allowed_plugins: FrozenSet[str] = [\"profile\"],\n ) -\u003e None:\n\n aiplatform.init(project=project, location=location, experiment=experiment_name)\n\n # one time upload\n aiplatform.upload_tb_log(\n tensorboard_experiment_name=experiment_name,\n logdir=logdir,\n run_name_prefix=run_name_prefix,\n allowed_plugins=allowed_plugins,\n )\n\n- `experiment_name`: The name of the TensorBoard experiment.\n- `logdir`: The directory location to check for TensorBoard logs.\n- `project`: . You can find these Project IDs in the Google Cloud console [welcome](https://console.cloud.google.com/welcome) page.\n- `location`: The location where your TensorBoard instance is located.\n- `run_name_prefix`: For profile data, this is the run prefix. The directory format within LOG_DIR should match the following:\n - `/RUN_NAME_PREFIX/plugins/profile/YYYY_MM_DD_HH_SS/`\n- `allowed_plugins`: A list of additional plugins to allow. For uploading profile data, this should include `\"profile\"`\n\n### gcloud CLI\n\n1. (Optional) Create a dedicated virtual environment to install the Vertex AI TensorBoard uploader Python CLI. \n\n ```python\n python3 -m venv PATH/TO/VIRTUAL/ENVIRONMENT\n source PATH/TO/VIRTUAL/ENVIRONMENT/bin/activate\n ```\n - \u003cvar translate=\"no\"\u003ePATH/TO/VIRTUAL/ENVIRONMENT\u003c/var\u003e: your dedicated virtual environment.\n2. Install the Vertex AI TensorBoard package through Vertex AI SDK. \n\n ```python\n pip install -U pip\n pip install google-cloud-aiplatform[tensorboard]\n ```\n3. Upload TensorBoard logs\n 1. Time Series and Blob Data \n\n tb-gcp-uploader --tensorboard_resource_name \\\n \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eTENSORBOARD_RESOURCE_NAME\u003c/span\u003e\u003c/var\u003e \\\n --logdir=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eLOG_DIR\u003c/span\u003e\u003c/var\u003e \\\n --experiment_name=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eTB_EXPERIMENT_NAME\u003c/span\u003e\u003c/var\u003e --one_shot=True\n\n 2. Profile Data \n\n tb-gcp-uploader \\\n --tensorboard_resource_name \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eTENSORBOARD_RESOURCE_NAME\u003c/span\u003e\u003c/var\u003e \\\n --logdir=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eLOG_DIR\u003c/span\u003e\u003c/var\u003e --experiment_name=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eTB_EXPERIMENT_NAME\u003c/span\u003e\u003c/var\u003e \\\n --allowed_plugins=\"profile\" --run_name_prefix=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eRUN_NAME_PREFIX\u003c/span\u003e\u003c/var\u003e \\\n --one_shot=True\n\n - \u003cvar translate=\"no\"\u003eTENSORBOARD_RESOURCE_NAME\u003c/var\u003e: The [TensorBoard Resource name](/vertex-ai/docs/experiments/tensorboard-setup#tensorboard_resource_name) used to fully identify the Vertex AI TensorBoard instance.\n - \u003cvar translate=\"no\"\u003eLOG_DIR\u003c/var\u003e: The location of the event logs that resides either in the local file system or Cloud Storage\n - \u003cvar translate=\"no\"\u003eTB_EXPERIMENT_NAME\u003c/var\u003e: The name of the TensorBoard experiment, for example `test-experiment`.\n - \u003cvar translate=\"no\"\u003eRUN_NAME_PREFIX\u003c/var\u003e: For profile data, this is the run prefix. The directory format within \u003cvar translate=\"no\"\u003eLOG_DIR\u003c/var\u003e should match the following:\n - `/RUN_NAME_PREFIX/plugins/profile/YYYY_MM_DD_HH_SS/`\n\nThe uploader CLI by default runs indefinitely, monitoring changes in the `LOG_DIR`,\nand uploads newly added logs. `--one_shot=True` disables the\nbehavior. Run `tb-gcp-uploader --help` for more information."]]