0
votes

i trying to submit a job in the google ml cloud.

  gcloud beta ml jobs submit training readlips_resnet1 \
  --package-path=trainer \
  --module-name=trainer.run \
  --staging-bucket=gs://xxxxbucket/ \
  --region=us-central1 \
  --scale-tier=BASIC_GPU \
  -- \
  --input_path gs://xxxxbucket/readlips/m1/readlips-test-1-{}.tfrecords \
  --input_path_test gs://xxxxbucket/readlips/m1/readlips-test-1-6.tfrecords \
  --board_path gs://my-first-bucket-mosnoi/readlips/m1/TFboard3_readlips_resnet \
  --model_dir gs://xxxxbucket/readlips/m1/models3 \
  --filenameNr 2 \
  --save_step 1000 \
  --display_step 100 \
  --max_steps 2000 \
  --batch_size 20 \
  --learning_rate 0.001 \
  --keep_prob 0.8 \
  --layers 3 \
  --hidden 150 \
  --rnn_cell LSTM \
  --optimizer ADAM \
  --initializer  graves \
  --bias -0.1 \
  --gpu

i am getting the next error

 Job [readlips_resnet1] submitted successfully.
 INFO    2017-02-28 12:14:48 +0200       unknown_task            Validating job requirements...
 INFO    2017-02-28 12:14:48 +0200       unknown_task            Job creation request has been successfully validated.
 INFO    2017-02-28 12:14:49 +0200       unknown_task            Job readlips_resnet1 is queued.
 ERROR: (gcloud.beta.ml.jobs.submit.training) UNAUTHENTICATED: Request
 had invalid authentication credentials. Expected OAuth 2 access token,
login cookie or other v alid authentication credential. See
 https://developers.google.com/identity/sign-in/web/devconsole-project.

i do not know how to set those 2 access token, i have looked in the documentation, i tryed gcloud beta init --account= and gcloud beta auth application-default login --client-id-file=. i have create the credentials, api key, OAuth 2.0 client IDs and Service account keys, but i do not know where to put it in order to my job to be run.

1

1 Answers

0
votes

Make sure you enable the Cloud API for your project, create a service account, and download a private key as JSON. The service account is most important in this case, as the error seems to point to invalid credentials.

You can read more detail on the "Creating and Managing Service Accounts" documentation.

Run the following command

gcloud iam service-accounts list

It should show you the list of service accounts associated with your GCP. Verify the service account using the following code:

from googleapiclient import discovery
from googleapiclient import http
from oauth2client.client import GoogleCredentials

credentials = GoogleCredentials.get_application_default()
my_project_id = 'my_current_project_id' # change according to your 
project id
projects = 'projects/' + my_project_id
ml_client = discovery.build(
    'ml',
    'v1',        
    requestBuilder=http.HttpRequest,
    credentials=credentials)
projs = ml_client.projects()
response = projs.getConfig(name = projects).execute()
SERVICE_ACCOUNT = response.get('serviceAccount')
print('Your Service Acc:', SERVICE_ACCOUNT)