GoogleCloudPlatform / cloudml-samples

Cloud ML Engine repo. Please visit the new Vertex AI samples repo at https://github.com/GoogleCloudPlatform/vertex-ai-samples
https://cloud.google.com/ai-platform/docs/
Apache License 2.0
1.52k stars 857 forks source link

Two errors when running census keras notebook #436

Closed datistiquo closed 5 years ago

datistiquo commented 5 years ago

I succeeded setting my cloud environment. Sadly part of the steps from https://github.com/GoogleCloudPlatform/cloudml-samples/blob/master/notebooks/tensorflow/getting-started-keras.ipynb

are not working.

1) It is working training local, but fails to export saved keras model?

T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
Traceback (most recent call last):
  File "C:\Users\\.conda\envs\census_keras\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\\.conda\envs\census_keras\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\\GCP\cloudml-samples-master\census\tf-keras\trainer\task.py", line 130, in <module>
    train_and_evaluate(args)
  File "C:\Users\\GCP\cloudml-samples-master\census\tf-keras\trainer\task.py", line 121, in train_and_evaluate
    export_path = tf.contrib.saved_model.save_keras_model(
AttributeError: module 'tensorflow.contrib.saved_model' has no attribute 'save_keras_model'

2) Also failing then submitting the training job to platform:

JOB_NAME = 'census_keras_test'
JOB_DIR = 'gs://' + BUCKET_NAME + '/census-test'

! gcloud ai-platform jobs submit training $JOB_NAME \
  --package-path trainer/ \
  --module-name trainer.task \
  --region $REGION \
  --python-version 3.5 \
  --runtime-version 1.13 \
  --job-dir $JOB_DIR \
  --stream-logs

Gives:

ERROR: (gcloud.ai-platform.jobs.submit.training) argument --job-dir: Must be of form gs://bucket/object Usage: gcloud ai-platform jobs submit training JOB --module-name=MODULE_NAME [optional flags] [-- USER_ARGS ...] optional flags may be --async | --config | --help | --job-dir | --labels | --package-path | --packages | --python-version | --region | --runtime-version | --scale-tier | --staging-bucket | --stream-logs

For detailed information on this command and its flags, run: gcloud ai-platform jobs submit training --help