Use GET instead of POST requests for hparams in colab environment. #4218
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.
Motivation for features / changes
Hparams dashboard does not work in Google-internal colab environments because they do not support POST requests.
Technical description of changes
Reuse mechanism introduced in scalars: don’t multiplex fetches in Colab #4191 that provides a 'tensorboardColab' query parameter in the URL to indicate a colab environment. If the value for the parameter is true then the Hparams dashboard will send GET requests. Otherwise it sends POST requests.
There already existed code that purported to determine if the hparams dashboard was running in a colab environment but this code has not worked for some time, possibly since colab: use proxyPort for dynamic plugin #2798. The code in this PR simply replaces that code. The plumbing to pipe this through other layers had already been implemented.
Tests
I loaded a local tensorboard with the query parameter 'tensorboardColab=true' and inspected the network tab to confirm that hparams-related calls were GET requests.
I loaded the local tensorboard without 'tensorboardColab' in the URL and inspected the network tab to confirm that hparams-related calls were POST requests.