ML_Engine
ML_Engine

Reputation: 1185

Tensorboard - can't connect from Google Cloud Instance

I'm trying to load Tensorboard from within my google cloud VM terminal.

tensorboard --logdir logs --port 6006

Serving TensorBoard on localhost; to expose to the network, use a proxy or pass --bind_all TensorBoard 2.2.1 at http://localhost:6006/ (Press CTRL+C to quit)

When I click on the link:

Chrome I get error 400

Firefox Error: Could not connect to Cloud Shell on port 6006. Ensure your server is listening on port 6006 and try again.

I've added a new firewall rule to allow port 6006 for ip 0.0.0.0/0 , but still can't get this to work. I've tried using --bind_all too but this doesn't work.

Upvotes: 0

Views: 683

Answers (2)

ML_Engine
ML_Engine

Reputation: 1185

For anyone else struggling with this, I decided to output my logs to an S3 bucket, and then rather than trying to run tensorboard from within the GCP instance, I just ran it locally, tested with the below script.

I needed to put this into a script rather than calling directly from the command line as I needed my AWS credentials to be loaded. I then use subprocess to run the command line function as normal.

Credentials contained within an env file, found using python-dotenv

from dotenv import find_dotenv, load_dotenv
import subprocess
load_dotenv(find_dotenv())


if __name__=='__main__':
    cmd = 'tensorboard --logdir s3://path-to-s3-bucket/Logs/'
    p = subprocess.Popen(cmd, shell=True)
    p.wait()



Serving TensorBoard on localhost; to expose to the network, use a proxy or pass --bind_all
TensorBoard 2.1.1 at http://localhost:6006/ (Press CTRL+C to quit)

enter image description here

Upvotes: 0

n1colas.m
n1colas.m

Reputation: 3989

From Training a Keras Model on Google Cloud ML GPU:

... To train this model now on google cloud ML engine run the below command on cloud sdk terminal

gcloud ml-engine jobs submit training JOB1 
  --module-name=trainer.cnn_with_keras 
  --package-path=./trainer 
  --job-dir=gs://keras-on-cloud
  --region=us-central1 
  --config=trainer/cloudml-gpu.yaml

Once you have started the training you can watch the logs from google console. Training would take around 5 minutes and the logs should look like below. Also you would be able to view the tensorboard logs in the bucket that we had created earlier named ‘keras-on-cloud’

To visualize the training and changes graphically open the cloud shell by clicking the icon on top right for the same. Once started type the below command to start Tensorboard on port 8080.

tensorboard --logdir=gs://keras-on-cloud --port=8080

Upvotes: 2

Related Questions